void loop() {
// put your main code here, to run repeatedly:
servo1.write(20);
servo1.write(160);
}
I suspect that after you get the use of the servo library figured out (look at the servo sweep example like septillian mentioned), you will want to allow some time between the 2 servo writes to give the servo time to move. Something like
void loop() {
// put your main code here, to run repeatedly:
servo1.write(20);
delay(1000);
servo1.write(160);
delay(1000);
}
And another idea for you. Once you start appending variable names with numbers like you did for servo1, servo2 and servo3, it is time to read up about arrays.