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