Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ServoTimer1.h>
- ServoTimer1 servo1;
- int tecla;
- void setup() {
- Serial.begin(9600);
- servo1.attach(9);
- }
- void loop() {
- if (Serial.available() > 0){
- tecla = Serial.read();
- if(tecla == 'z'){
- Serial.println("Esquerda");
- servo1.write(110);
- }
- if(tecla == 'c'){
- Serial.println("Direita");
- servo1.write(70);
- }
- if(tecla == 'x'){
- Serial.println("Centro");
- servo1.write(90);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement