Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1.  
  2. int buttonPin = A7;
  3. int buttonValue = 1;
  4. int currentState = 0;
  5.  
  6. void setup() {
  7. pinMode(buttonPin, INPUT_PULLUP);
  8. }
  9.  
  10. void loop() {
  11. buttonValue = digitalRead(buttonPin);
  12. if (buttonValue == LOW) {
  13. if (currentState == 0) {
  14. currentState = 1;
  15. // WRITE YOUR MOTOR CODE FOR POSITION 1
  16. }
  17. else {
  18. currentState = 0;
  19. //WRITE YOUR MOTOR CODE FOR POSITION 2
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement