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