I am using arduino IDE 1.6.2 herse is the code I am using:
#include <Servo.h>
Servo servoL;
Servo servoR;
const int buttonPin = 8;
void setup(){
servoL.attach(6);
servoR.attach(7);
pinMode(buttonPin, INPUT);
}
void loop(){
if(digitalRead(buttonPin) == HIGH){
servoL.write(180);
servoR.write(180);
delay(5000);
servoL.write(92);
servoR.write(92);
servoL.write(0);
servoR.write(180);
delay(5000);
servoL.write(92);
servoR.write(92);
servoL.write(180);
servoR.write(180);
delay(5000);
servoL.write(92);
servoR.write(92);
servoL.write(0);
servoR.write(180);
delay(5000);
servoL.write(92);
servoR.write(92);
}
else{
servoL.write(92);
servoR.write(92);
}
}
end of code____________________________
I get this message that says:
Arduino: 1.6.2 (Windows 8.1), Board: "Arduino Uno"
Sketch uses 2,816 bytes (8%) of program storage space. Maximum is 32,256 bytes.
Global variables use 57 bytes (2%) of dynamic memory, leaving 1,991 bytes for local variables. Maximum is 2,048 bytes.
avrdude: ser_open(): can't open device "\.\COM1": The system cannot find the file specified.
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.