WiringProject / Wiring

Wiring Framework
http://wiring.org.co/
Other
217 stars 168 forks source link

Button library has bounce issues #15

Closed AlexanderBrevig closed 11 years ago

AlexanderBrevig commented 12 years ago

Thanks to: Vytautas Janušonis

Reproduce errors using:

include

Button button = Button(2,PULLUP);

int counter = 0;

void setup() { pinMode(13, OUTPUT); //debug to led 13 Serial.begin(9600); }

void loop() { if(button.uniquePress()) // kitos galimos funkcijos: | isPressed() | wasPressed() | stateChanged() { counter++; Serial.print("On\n"); Serial.println(counter); digitalWrite(13,HIGH); } }

I guess we should add some debounce time constant as to prevent a high frequency registration of presses.