Color sphero example
This commit is contained in:
parent
046c3578a5
commit
6bf47abf3c
|
@ -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()
|
Loading…
Reference in New Issue