#include Servo servo1; Servo servo2; void setup() { servo1.attach(9); servo2.attach(10); Serial.begin(9600); Serial.print("format : [0-180][ab]"); } void loop() { static int v = 0; if ( Serial.available() ) { char ch = Serial.read(); switch(ch) { case '0'...'9': v = v * 10 + ch - '0'; break; case 'a': servo1.write(v); v = 0; break; case 'b': servo2.write(v); v = 0; break; } } }