Added pinMode setting to attach

Added possibility to attach the pin and auto set the pinMode. Attach and
pinMode can now be done in 1 step. just call Bounce.attach(pin,
INPUT_PULLUP) etc
This commit is contained in:
sseptillion
2015-09-08 11:34:38 +02:00
parent ea7731102f
commit 50b796ccfc
+11
View File
@@ -33,6 +33,17 @@ void Bounce::attach(int pin) {
#endif
}
void Bounce::attach(int pin, byte mode){
if(mode == INPUT_PULLUP){
pinMode(pin, INPUT_PULLUP);
}
else{
pinMode(pin, INPUT);
}
this->attach(pin);
}
void Bounce::interval(uint16_t interval_millis)
{
this->interval_millis = interval_millis;