Color sphero example

This commit is contained in:
deadprogram 2013-10-24 17:01:25 -07:00
parent 046c3578a5
commit 6bf47abf3c
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
Cylon = require('..')
Cylon.robot
connection:
name: 'sphero', adaptor: 'sphero', port: '/dev/rfcomm0'
device:
name: 'sphero', driver: 'sphero'
work: (me) ->
me.nextColor = ->
@color ?= 0x000050
@color += 0x005000
@color = 0x000050 if @color > 0xFFFFFF
@color
every 1.second(), ->
me.sphero.setRGB me.nextColor()
.start()