Sha256: b4c83d289a07f60888eef4f9952f50dd383481d4c92b887c39585f8340392622

Contents?: true

Size: 662 Bytes

Versions: 17

Compression:

Stored size: 662 Bytes

Contents

require 'artoo/robot'
           
class DoubleSpheroRobot < Artoo::Robot
  connection :sphero, :adaptor => :sphero
  device :sphero, :driver => :sphero
  
  work do
    @count = 1
    every(3.seconds) do
      sphero.set_color(@count % 2 == 0 ? :green : :blue)
      @count += 1
      sphero.roll 90, rand(360)
    end
  end
end

SPHEROS = {"127.0.0.1:4560" => "/dev/tty.Sphero-BRG-RN-SPP",
           "127.0.0.1:4561" => "/dev/tty.Sphero-YBW-RN-SPP"}
robots = []
SPHEROS.each_key {|p|
  robots << DoubleSpheroRobot.new(:connections => 
                              {:sphero => 
                                {:port => p}})
}

DoubleSpheroRobot.work!(robots)

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
artoo-sphero-1.5.1 examples/sphero2.rb
artoo-sphero-1.5.0 examples/sphero2.rb
artoo-sphero-1.4.0 examples/sphero2.rb
artoo-sphero-1.3.0 examples/sphero2.rb
artoo-sphero-1.2.0 examples/sphero2.rb
artoo-sphero-1.1.1 examples/sphero2.rb
artoo-sphero-1.1.0 examples/sphero2.rb
artoo-sphero-1.0.1 examples/sphero2.rb
artoo-sphero-1.0.1.pre examples/sphero2.rb
artoo-sphero-1.0.0 examples/sphero2.rb
artoo-sphero-1.0.0.rc2 examples/sphero2.rb
artoo-sphero-1.0.0.rc1 examples/sphero2.rb
artoo-sphero-1.0.0.pre examples/sphero2.rb
artoo-0.5.0 examples/sphero2.rb
artoo-0.4.1 examples/sphero2.rb
artoo-0.4.0 examples/sphero2.rb
artoo-0.3.0 examples/sphero2.rb