2013-10-24 10:58:51 +08:00
|
|
|
Cylon = require('..')
|
2013-10-24 04:27:23 +08:00
|
|
|
|
2013-10-25 02:25:45 +08:00
|
|
|
cylon = Cylon.robot
|
2013-10-24 04:27:23 +08:00
|
|
|
connection:
|
2013-10-24 14:18:19 +08:00
|
|
|
name: 'sphero', adaptor: 'sphero', port: '/dev/rfcomm0'
|
2013-10-24 04:27:23 +08:00
|
|
|
|
2013-10-24 14:18:19 +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
|
|
|
|
2013-10-25 02:51:45 +08:00
|
|
|
cylon.connections['sphero'].on('connected', ->
|
|
|
|
console.log('CONNECTED EVENT TRIGGERED!')
|
2013-10-25 02:25:45 +08:00
|
|
|
)
|
|
|
|
cylon.start()
|