From 8372486a00235adcf7e90fddc58d8081c4b17b92 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Mon, 28 Oct 2013 09:25:07 -0700 Subject: [PATCH] Almost the button example --- examples/button.coffee | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 examples/button.coffee diff --git a/examples/button.coffee b/examples/button.coffee new file mode 100644 index 0000000..b585f67 --- /dev/null +++ b/examples/button.coffee @@ -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()