#include <Servo.h>
byte pinButton1 = 3;
byte pinButton2 = 5;
byte pinServo1 = 4;
byte pinServo2 = 6;
Servo myServo1;
Servo myServo2;
void setup() {
// put your setup code here, to run once:
pinMode(pinButton1, INPUT_PULLUP);
pinMode(pinButton2, INPUT_PULLUP);
myServo1.attach(pinServo1);
myServo2.attach(pinServo2);
myServo1.write(0);
myServo2.write(0);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(pinButton1) == LOW){
delay(50);
myServo1.write(180);
}
else{
myServo1.write(0);
}
if(digitalRead(pinButton2) == LOW){
delay(50);
myServo2.write(180);
}
else{
myServo2.write(0);
}
}