Added example sketches.

Changed debounce logic to subtract ms times.
This commit is contained in:
Jack Christensen
2012-03-24 22:53:11 -04:00
parent bc98c94c53
commit c52f4952b4
5 changed files with 255 additions and 1 deletions

View File

@@ -59,7 +59,7 @@ uint8_t Button::read(void)
ms = millis();
pinVal = digitalRead(_pin);
if (_invert != 0) pinVal = !pinVal;
if (ms < _lastChange + _dbTime) {
if (ms - _lastChange < _dbTime) {
_lastTime = _time;
_time = ms;
_changed = 0;