Advertisement
Guest User

Servo Motor Code

a guest
Oct 15th, 2015
621
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <Servo.h>
  2.  
  3. Servo myservo;
  4.  
  5. int position = 0;
  6.  
  7. void setup() {
  8. myservo.attach(9);
  9. }
  10.  
  11. void loop() {
  12. for (position = 0; position <= 180; position += 1) {
  13. myservo.write(position);
  14. delay(15);
  15. }
  16. for (position = 180; position >= 0; position -= 1) {
  17. myservo.write(position);
  18. delay(15);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement