Paso 1: Conexiones y código
#include < Servo.h >
byte com = 0;
Servo myServo;
void setup() {Serial.begin(9600);
myServo.attach(9);
Delay(2000);
Serial.Write(0xAA);
Serial.Write(0x37);
Delay(1000);
Serial.Write(0xAA);
Serial.Write(0x21); }
void loop() {}
{while(serial.Available())}
com = Serial.read();
{Switch(com)}
caso 0x11: //command 1
myServo.write(0);
rotura;
caso 0x12: //command 2
myServo.write(45);
rotura;
caso 0 x 13: //command 3
myServo.write(90);
rotura;
caso 0x14: //command 4 myServo.write(135);
rotura;
caso 0x15: myServo.write(180) //command 5;
rotura;
}
}
}