pushButton.ino 316 B

1234567891011
  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("Button\n");
  9. }
  10. last_interrupt_time = interrupt_time;
  11. }