Skip to content

Instantly share code, notes, and snippets.

@treble37
Forked from deadprogram/1_sphero_color.rb
Created February 8, 2014 03:30
Show Gist options
  • Save treble37/8876309 to your computer and use it in GitHub Desktop.
Save treble37/8876309 to your computer and use it in GitHub Desktop.
require 'artoo'
connection :sphero, :adaptor => :sphero, :port => '127.0.0.1:4560'
device :sphero, :driver => :sphero
work do
every(3.seconds) do
if @color == :green
@color = :blue
else
@color = :green
end
sphero.set_color(@color)
end
end
require 'artoo'
connection :sphero, :adaptor => :sphero, :port => '127.0.0.1:4560'
device :sphero, :driver => :sphero
work do
every(3.seconds) do
if @color == :green
@color = :blue
else
@color = :green
end
sphero.set_color(@color)
sphero.roll 60, rand(360)
end
end
require 'artoo'
connection :sphero, :adaptor => :sphero, :port => '127.0.0.1:4560'
device :sphero, :driver => :sphero
api :host => '127.0.0.1', :port => '4567'
work do
every(3.seconds) do
if @color == :green
@color = :blue
else
@color = :green
end
sphero.set_color(@color)
sphero.roll 60, rand(360)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment