pushButton.ino 429 B

123456789101112131415
  1. void pushButton()
  2. {
  3. static unsigned long last_interrupt_time = 0;
  4. unsigned long interrupt_time = millis();
  5. // If interrupts come faster than 200ms, assume it's a bounce and ignore
  6. if (interrupt_time - last_interrupt_time > 200)
  7. {
  8. Serial.print("Switching mode to MODE_COUNTING\n");
  9. mode = MODE_COUNTING;
  10. recordedTimes = 0;
  11. showShape(2);
  12. showShapeLAP(2);
  13. }
  14. last_interrupt_time = interrupt_time;
  15. }