Paso 4: código
#include <Servo.h> //Feel free to make changes:) Servo leftservo; Servo rightservo; int led = 13; Servo bottom; Servo top; char val; void setup() { Serial.begin(9600); pinMode(led, OUTPUT); leftservo.attach(9); rightservo.attach(10); top.attach(6); bottom.attach(5); } void loop() { if( Serial.available() ){ val = Serial.read(); //===================================================================================================== //You may need to mess around with the servo values to get the correct keys to the servo and directions //===================================================================================================== //Tera Term sends A,B,C,D values back for the arrow keys if (val == 'B'){// down arrow rightservo.write(0); leftservo.write(0); } else if (val == 'A'){ // up arrow rightservo.write(180); leftservo.write(180); } else if (val == 'C'){ // left arrow? migh switched these up rightservo.write(180); leftservo.write(0); } else if (val == 'D'){ // right arrow? rightservo.write(0); leftservo.write(180); } else if (val == 'f'){// FIRE!!!!! digitalWrite(led, HIGH); delay(1000); digitalWrite(led, LOW); } else if (val == 'w'){//pan and tilt top.write(180); } else if (val == 's'){ top.write(0); } else if (val == 'a'){ bottom.write(0); } else if (val == 'd'){ bottom.write(180); } else{ leftservo.write(90); // press any button to stop rightservo.write(90); } } }