Sha256: b1a288eccc548ef4c099dec3337a2fd7b4f8e9562edfe0704864956a6ea69c19

Contents?: true

Size: 1000 Bytes

Versions: 46

Compression:

Stored size: 1000 Bytes

Contents

require 'artoo/robot'
           
class SpheroRobot < Artoo::Robot
  connection :sphero, :adaptor => :sphero
  device :sphero, :driver => :sphero
  
  #api :host => '127.0.0.1', :port => '8080'

  work do
    @count = 1
    
    every(3.seconds) do
      sphero.set_color(@count % 2 == 0 ? :white : :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",
           "127.0.0.1:4562" => "/dev/tty.Sphero-BWY-RN-SPP",
           "127.0.0.1:4563" => "/dev/tty.Sphero-YRR-RN-SPP",
           "127.0.0.1:4564" => "/dev/tty.Sphero-OBG-RN-SPP",
           "127.0.0.1:4565" => "/dev/tty.Sphero-GOB-RN-SPP",
           "127.0.0.1:4566" => "/dev/tty.Sphero-PYG-RN-SPP"}
robots = []
SPHEROS.each_key {|p|
  robots << SpheroRobot.new(:connections => 
                              {:sphero => 
                                {:port => p}})
}

SpheroRobot.work!(robots)

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
artoo-1.8.2 examples/sphero_multiple.rb
artoo-1.8.1 examples/sphero_multiple.rb
artoo-sphero-1.5.1 examples/sphero_multiple.rb
artoo-sphero-1.5.0 examples/sphero_multiple.rb
artoo-1.8.0 examples/sphero_multiple.rb
artoo-sphero-1.4.0 examples/sphero_multiple.rb
artoo-1.6.7 examples/sphero_multiple.rb
artoo-1.6.6 examples/sphero_multiple.rb
artoo-1.6.5 examples/sphero_multiple.rb
artoo-1.6.4 examples/sphero_multiple.rb
artoo-1.6.3 examples/sphero_multiple.rb
artoo-1.6.2 examples/sphero_multiple.rb
artoo-1.6.1 examples/sphero_multiple.rb
artoo-sphero-1.3.0 examples/sphero_multiple.rb
artoo-1.6.0 examples/sphero_multiple.rb
artoo-1.5.0 examples/sphero_multiple.rb
artoo-sphero-1.2.0 examples/sphero_multiple.rb
artoo-1.4.1 examples/sphero_multiple.rb
artoo-1.4.0 examples/sphero_multiple.rb
artoo-1.3.0 examples/sphero_multiple.rb