cylon/examples/button.coffee

19 lines
383 B
CoffeeScript
Raw Normal View History

2013-10-29 00:25:07 +08:00
Cylon = require('..')
# Initialize the robot
Cylon.robot
connection:
name: 'arduino', adaptor: 'firmata', port: '/dev/ttyACM0'
devices:
[
{name: 'led', driver: 'led', pin: 13},
{name: 'button', driver: 'button', pin: 2}
]
work: (my) ->
2013-10-29 06:37:25 +08:00
my.button.on 'push', -> Logger.info 'wow' #my.led.toggle()
2013-10-29 06:31:39 +08:00
every 1.second(), -> my.led.toggle()
2013-10-29 03:02:38 +08:00
2013-10-29 00:25:07 +08:00
.start()