Added new Digital read example for raspi, updated digitalRead in lib.

This commit is contained in:
Edgar O Silva 2013-11-06 11:02:20 -06:00
parent 9c0ef5408c
commit c370041329
3 changed files with 21 additions and 0 deletions

2
dist/digital-pin.js vendored
View File

@ -99,6 +99,8 @@
return _this.self.emit('error', "Error occurred while reading from pin " + _this.pinNum);
} else {
readData = data;
console.log("Digital read VALUE ===>");
console.log(data);
return _this.self.emit('digitalRead', data);
}
});

View File

@ -0,0 +1,17 @@
Cylon = require('..')
# Initialize the robot
Cylon.robot
connection:
name: 'raspi', adaptor: 'raspi'
devices:
[
{name: 'led', driver: 'led', pin: 13},
{name: 'button', driver: 'button', pin: 2}
]
work: (my) ->
my.button.on 'push', -> my.led.toggle()
.start()

View File

@ -71,6 +71,8 @@ namespace 'Cylon.IO', ->
@self.emit('error', "Error occurred while reading from pin #{ @pinNum }")
else
readData = data
console.log("Digital read VALUE ===>")
console.log(data)
@self.emit('digitalRead', data)
)