cylon/examples/button.coffee

19 lines
383 B
CoffeeScript

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) ->
my.button.on 'push', -> Logger.info 'wow' #my.led.toggle()
every 1.second(), -> my.led.toggle()
.start()