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