Almost the button example

This commit is contained in:
deadprogram 2013-10-28 09:25:07 -07:00
parent 16a049f586
commit 8372486a00
1 changed files with 18 additions and 0 deletions

18
examples/button.coffee Normal file
View File

@ -0,0 +1,18 @@
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) ->
# we do our thing here
my.button.on 'pushed', -> my.led.toggle()
#my.button.on 'released', -> Logger.info 'ho'
.start()