Skip to content

Instantly share code, notes, and snippets.

@deadprogram
Created February 7, 2014 16:28
Show Gist options
  • Save deadprogram/8866295 to your computer and use it in GitHub Desktop.
Save deadprogram/8866295 to your computer and use it in GitHub Desktop.
Artoo example code for the LARubyConf 2013 Robot Hackathon
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