CCCPaste

AnalemmaGPSArduino rev_02

/********* Pleasedontcode.com **********

	Pleasedontcode thanks you for automatic code generation! Enjoy your code!

	- Terms and Conditions:
	You have a non-exclusive, revocable, worldwide, royalty-free license
	for personal and commercial use. Attribution is optional; modifications
	are allowed, but you're responsible for code maintenance. We're not
	liable for any loss or damage. For full terms,
	please visit pleasedontcode.com/termsandconditions.

	- Project: AnalemmaGPSArduino
	- Source Code compiled for: Arduino Uno
	- Source Code created on: 2023-11-18 00:41:53
	- Source Code generated by: gianluca

********* Pleasedontcode.com **********/
/****** DEFINITION OF LIBRARIES *****/
#include 
#include 

Servo myservo;

// GPS variables
unsigned long previousMillis = 0;
const long interval = 10000;  // move the servo every 10 seconds
const int servoMinAngle = 0; // minimum servo angle
const int servoMaxAngle = 180; // maximum servo angle
int servoAngle = servoMinAngle;

void setup() {
  myservo.attach(9); // Replace 9 with the actual pin number
}

void loop() {
  // put your main code here, to run repeatedly:

  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= interval) {
    // move the servo every 10 seconds
    previousMillis = currentMillis;

    // update the servo angle
    if (servoAngle == servoMinAngle) {
      servoAngle = servoMaxAngle; // move the servo to maximum angle
    } else {
      servoAngle = servoMinAngle; // move the servo to minimum angle
    }

    // set the servo angle
    myservo.write(servoAngle);
  }
}