cylon/examples/button.coffee

18 lines
323 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 09:26:16 +08:00
my.button.on 'push', -> my.led.toggle()
2013-10-29 03:02:38 +08:00
2013-10-29 00:25:07 +08:00
.start()