Skip to content

Commit

Permalink
initialize pin var in begin()
Browse files Browse the repository at this point in the history
  • Loading branch information
LennartHennigs committed Sep 12, 2021
1 parent 1262409 commit e8e2903
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Button2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ void Button2::begin(byte attachTo, byte buttonMode /* = INPUT_PULLUP */, boolean
} else {
is_capacitive = true;
}
// state = activeLow ? HIGH : LOW;
state = _getState();
prev_state = state ;
}
Expand Down Expand Up @@ -177,7 +178,7 @@ byte Button2::getClickType() const {
/////////////////////////////////////////////////////////////////

byte Button2::_getState() {
byte state;
byte state = 0;
if (!is_capacitive) {
state = digitalRead(pin);
} else {
Expand Down

0 comments on commit e8e2903

Please sign in to comment.