Advertisement
Guest User

wall-e controller arduino

a guest
Jul 23rd, 2014
6,542
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include <Servo.h>
  2.  
  3. Servo myservo;  // create servo object to control a servo
  4.  
  5. void setup()
  6. {
  7.   myservo.attach(9);  // attaches the servo on pin 9 to the servo object
  8.   Serial.begin(9600);
  9. }
  10.  
  11.  
  12. void loop()
  13. {
  14.   if(Serial.available()>0){
  15.     byte angel=Serial.read();
  16.     Serial.println(angel);
  17.     myservo.write(angel);
  18.   }
  19.   delay(1);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement