Advertisement
Guest User

Untitled

a guest
Dec 9th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. long first = 0;
  2. long second = 0;
  3. int zoneSelected = 0;
  4. int times = 0;
  5.  
  6. if (y > 510 && x > 520 && x < 800 && y <800)
  7. {
  8. zoneSelected = 1;
  9. first = millis();
  10. }
  11. else
  12. if (y>510 && x < 510)
  13. {
  14. zoneSelected = 2;
  15. }
  16. else
  17. if (y<500 && x>520)
  18. {
  19. zoneSelected = 3;
  20. }
  21. else
  22. if (y<500 && x<510)
  23. {
  24. zoneSelected = 4;
  25. }
  26. else
  27. if (x>800 && y>800)
  28. {
  29. //this will be called each time a finger is lifted
  30. second = millis();
  31. if(second - first < 300) {
  32. //possible double tap
  33. times++;
  34. second = millis();
  35. first = second;
  36. } else {
  37. times = 0;
  38. second = millis();
  39. first = second;
  40. }
  41.  
  42. if(times%2 == 0) {Serial.println(String(zoneSelected)); times = 0; }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement