#include int SRV = 9; int count = 0; Servo myservo; void setup(){ Serial.begin(9600); pinMode(SRV, OUTPUT); } void loop(){ count++; Serial.write(count); while(Serial.available()){ if((count % 2) == 1){ myservo.attach(9); myservo.write(0); delay(500); myservo.write(180); delay(500); } } }