Sha256: 02930fe73f42506349646b245077b33f8c831dd4f3ec6c97420f5a9e6ebe5250

Contents?: true

Size: 411 Bytes

Versions: 3

Compression:

Stored size: 411 Bytes

Contents

require 'artoo'

connection :sphero, :adaptor => :sphero, :port => '/dev/rfcomm0' #linux
#connection :sphero, :adaptor => :sphero, :port => '127.0.0.1:4567'
device :sphero, :driver => :sphero

def contact(*args)
  @contacts ||= 0
  @contacts += 1
  puts "Contact #{@contacts}"
end

work do
  on sphero, :collision => :contact

  every(3.seconds) do
    puts "Rolling..."
    sphero.roll 90, rand(360)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
artoo-sphero-1.5.1 examples/sphero_messages.rb
artoo-sphero-1.5.0 examples/sphero_messages.rb
artoo-sphero-1.4.0 examples/sphero_messages.rb