Stap 1: Verbindingen en Code
#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) {}
kast 0x11: //command 1
myServo.write(0);
breken;
geval van 0x12: //command 2
myServo.write(45);
breken;
kast 0x13: //command 3
myServo.write(90);
breken;
kast 0x14: //command 4 myServo.write(135);
breken;
kast 0x15: //command 5 myServo.write(180);
breken;
}
}
}