cylon/examples/sphero.coffee

19 lines
408 B
CoffeeScript
Raw Normal View History

2013-10-24 10:58:51 +08:00
Cylon = require('..')
2013-10-24 04:27:23 +08:00
cylon = Cylon.robot
2013-10-24 04:27:23 +08:00
connection:
name: 'sphero', adaptor: 'sphero', port: '/dev/rfcomm0'
2013-10-24 04:27:23 +08:00
device:
name: 'sphero', driver: 'sphero'
work: (me) ->
every 1.second(), -> me.sphero.roll(60, Math.floor(Math.random() * 360), 1)
2013-10-24 04:27:23 +08:00
console.log(cylon.devices['sphero'])
cylon.devices['sphero'].on('driver_load', ->
console.log("DRIVER LOAD EVENT TRIGGERED!")
)
cylon.start()