| 12345678910111213141516 |
- void pushButton()
- {
- static unsigned long last_interrupt_time = 0;
- unsigned long interrupt_time = millis();
- // If interrupts come faster than 200ms, assume it's a bounce and ignore
- if (interrupt_time - last_interrupt_time > 200)
- {
- Serial.print("Button\n");
- if (mode == MODE_SPINUP) {
- Serial.print("Switching mode to MODE_COUNTING\n");
- mode = MODE_COUNTING;
- recordedLaps = 0;
- }
- }
- last_interrupt_time = interrupt_time;
- }
|