weinerm21

Untitled

Jun 11th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <Servo.h>
  2. Servo myServo;
  3.  
  4. int const potPin = A0;
  5. int potVal;
  6. int angle;
  7.  
  8. void setup()
  9. {
  10. // put your setup code here, to run once:
  11. myServo.attach(9);
  12. Serial.begin(9600);
  13. }
  14. void loop()
  15. {
  16. // put your main code here, to run repeatedly:
  17. for(int angle= 0; angle <180; angle++)
  18. {
  19. myServo.write(angle);
  20. delay(15);
  21. }
  22. for(int angle= 179; angle >0; angle--)
  23. {
  24. myServo.write(angle);
  25. delay(15);
  26. }
  27. }
Add Comment
Please, Sign In to add comment