Guest User

Untitled

a guest
Nov 22nd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. void loop() {
  2. static int change = 0;
  3. static int pos = 0;
  4. static int oldPos = 0;
  5. //Read the Encoder's state
  6. encoder.tick();
  7. int enc = encoder.getPosition();
  8. change = oldPos - abs(enc) % 2;
  9. if (change != 0) {
  10.  
  11. switch (i) {
  12. case 0:
  13. //do a program that lasts 5 seconds
  14. break;
  15. case 1:
  16. //do a program that lasts 5 seconds
  17. break;
  18. }
  19. oldPos = pos;
  20. change = 0;
  21. }
  22. }
Add Comment
Please, Sign In to add comment