Someone else gave me this code which allows the button to start the cycle but the servo only goes to 180 when I hit the button. Any ideas on how to allow the 24 hour cycle to play out but be overridden by pressing the button?
#include <Servo.h>
Servo myservo;
const int BUTTON_PIN = 7;
const int SERVO_PIN = 9;
void setup(){
myservo.attach(SERVO_PIN);
Serial.begin(9600);
pinMode(BUTTON_PIN, INPUT_PULLUP);
myservo.write(0);
}
void loop(){
if(!digitalRead(BUTTON_PIN))
{
myservo.write(180); //(open?)
delay(6000);
myservo.write(0);
delay(86400000);
}
}