Added new Digital read example for raspi, updated digitalRead in lib.
This commit is contained in:
parent
9c0ef5408c
commit
c370041329
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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()
|
|
@ -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)
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue