Fix bug in PushButton()
Ensure a pin value of -1 is retained so that any further calls to other methods are disabled if the pin is not defined.
This commit is contained in:
parent
d4603df58d
commit
7c32f7a364
|
|
@ -97,12 +97,12 @@ PushButton::PushButton(int pin){
|
|||
|
||||
void PushButton::init(int pin){
|
||||
|
||||
this->pin=pin;
|
||||
if(pin<0)
|
||||
return;
|
||||
|
||||
status=0;
|
||||
doubleCheck=false;
|
||||
this->pin=pin;
|
||||
pinMode(pin, INPUT_PULLUP);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue