Use debouncer for button states
This commit is contained in:
parent
373266f6be
commit
5eecc507a0
|
@ -51,10 +51,10 @@ void read_buttons(){
|
||||||
Stw_data.Stw_shift_down = debouncer[4].rose();
|
Stw_data.Stw_shift_down = debouncer[4].rose();
|
||||||
Stw_data.Stw_shift_up = debouncer[5].rose();
|
Stw_data.Stw_shift_up = debouncer[5].rose();
|
||||||
|
|
||||||
Stw_data.buttonState1 = digitalRead(button1);
|
Stw_data.buttonState1 = debouncer[0].isPressed();
|
||||||
Stw_data.buttonState4 = digitalRead(button4);
|
Stw_data.buttonState4 = debouncer[3].isPressed();
|
||||||
Stw_data.buttonStateEnc1 = digitalRead(enc1PinS);
|
Stw_data.buttonStateEnc1 = debouncer[6].isPressed();
|
||||||
Stw_data.buttonStateEnc2 = digitalRead(enc2PinS);
|
Stw_data.buttonStateEnc2 = debouncer[7].isPressed();
|
||||||
if (debouncer[0].rose()) {
|
if (debouncer[0].rose()) {
|
||||||
Stw_data.button1_rises++;
|
Stw_data.button1_rises++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue