Download the file
  1. #ifndef pushbutton_h
  2. #define pushbutton_h
  3.  
  4. #include <WProgram.h>
  5.  
  6. class PushButton {
  7. uint8_t pin;
  8. uint8_t old_state;
  9. static int8_t states[];
  10. unsigned long lastMillis;
  11. public:
  12. PushButton(uint8_t pin);
  13. uint8_t getState(uint8_t debounce=25); // 1/100th seconds, not milliseconds
  14. int8_t getEdge();
  15. uint8_t getPressed();
  16. uint8_t getReleased();
  17. };
  18.  
  19. #endif
  20. // vim:ft=arduino
  21.