File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -111,13 +111,15 @@ bool MyButton :: readRisingClick(){
111111 if (digitalRead (button_pin) == (1 - off_state)){
112112 time_since_clicked = millis ();
113113 btn_state = WAIT_BTN;
114+ rised = 1 ;
114115 }
115116 break ;
116117 case WAIT_BTN:
117118 if (digitalRead (button_pin) == off_state){
118119 btn_state = READ_BTN;
119120 }
120- else if (millis () - time_since_clicked >= debounce_time){
121+ else if ((millis () - time_since_clicked >= debounce_time) && rised){
122+ rised = 0 ;
121123 return true ;
122124 }
123125 break ;
Original file line number Diff line number Diff line change 5353 uint8_t btn_state_multiple; // State of the button in the multiple behaviors function
5454 unsigned long time_since_clicked; // Keeps track of the timings
5555 uint32_t timed_read; // To hold the timed read time in microseconds
56+ uint8_t rised; // This flag is used to only send the "rised" detection
5657
5758 /* Button parameters */
5859 uint8_t button_pin;
You can’t perform that action at this time.
0 commit comments