#include <Servo.h>;
const int buttonPin = 8;
const int servo1Pin = 9;
const int servo2Pin = 10;
Servo servo1;
Servo servo2;
int counter = 0;
void setup()
{
servo1.attach (servo1Pin);
servo2.attach (servo2Pin);
// Set up the pushbutton pins to be an input:
pinMode(buttonPin, INPUT);
}
void loop()
{
// local variable to hold the pushbutton states
int buttonState;
//read the digital state of buttonPin with digitalRead() function and store the //value in buttonState variable
buttonState = digitalRead(buttonPin);
//if the button is pressed increment counter and wait a tiny bit to give us some //time to release the button
if (buttonState == HIGH) // light the LED
{
servo1.write(0);
servo2.write(0);
delay(300);
servo1.write(180);
servo2.write(180);
delay(500);
servo1.write(90);
servo2.write(90);
delay(500);
}
}