#include <Servo.h>
const int led1 = 12;
const int button1 = 7;
const int button2 = 8;
const int myservo = 3;
int angle = 0;
Servo s1;
void setup() {
// put your setup code here, to run once:
s1.attach(myservo);
pinMode(led1, OUTPUT);
pinMode(button1, INPUT_PULLUP);
pinMode(button2, INPUT_PULLUP);
}
void loop() {
// put your main code here, to run repeatedly:
int b1 = digitalRead(button1);
int b2 = digitalRead(button2);
for(angle = 0; angle <180;angle +=1);
if (b1 == LOW || b2 == LOW ){ //ORGATE ||
digitalWrite(led1, HIGH);
s1.write(angle);
delay(100);
}else{
for(angle = 180;angle >=1;angle -=1);
digitalWrite(led1, LOW);
s1.write(angle);
delay(100);
}
}