Advertisement
Guest User

Untitled

a guest
Nov 14th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <Adafruit_CircuitPlayground.h>
  2. #include <Adafruit_Circuit_Playground.h>
  3.  
  4. //Servo code
  5. #include <Servo.h>
  6.  
  7. Servo servo1;
  8.  
  9. void setup() {
  10. // put your setup code here, to run once:
  11. CircuitPlayground.begin();
  12.  
  13. servo1.attach(10); //pin 10
  14.  
  15. }
  16. bool stop = false;
  17.  
  18. void loop() {
  19. // put your main code here, to run repeatedly:
  20. if (CircuitPlayground.leftButton() == true) {
  21. if (stop == false)
  22. stop = true;
  23. else
  24. stop = false;
  25. }
  26.  
  27. if (stop == true){
  28. servo1.write(0);
  29. }
  30. else
  31. servo1.write(180);
  32. delay(100);
  33.  
  34.  
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement