Hi guys
I am working on a project, it's a battery power device. So the device needs to sleep as much as possible. And I don't want to use delay within interrupt to debounce.
The interrupt is triggered by a push button. Thanks guys!
uint8_t global_var_state_1; uint8_t global_var_state_2; uint8_t global_var_state_3; while(1) { //state machine bases on //input from global variables sleep(); } ISR(PIN_CHANGE_vect) { //debounce (how?, don't want to use delay here) if (button_press_is_valid) { //change values of global_var //for state machine. } }