Skip to content

Commit

Permalink
Merge pull request #6 from richkzad/patch-1
Browse files Browse the repository at this point in the history
[minor] Fix button down detection
  • Loading branch information
Cam Pedersen committed Mar 2, 2012
2 parents cad0d49 + d2eb7af commit dc7e870
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ var Button = function (options) {
this.board.on('data', function (m) {
m = m.slice(0, -1).split('::');
if (m.length > 1 && m[0] == self.pin) {
// 1 is up
// 0 is down
if (m[1] == '1' && self.down) {
// 0 is up
// 1 is down
if (m[1] == 0 && self.down) {
self.down = false;
self.emit('up');
}
if (m[1] == '0' && !self.down) {
if (m[1] == 1 && !self.down) {
self.down = true;
self.emit('down');
}
Expand Down

0 comments on commit dc7e870

Please sign in to comment.