Sha256: f7bb75b7a0a68f60fb6d3644f73c31afd51612572826333800adf0b0d3ca9b2a
Contents?: true
Size: 658 Bytes
Versions: 6
Compression:
Stored size: 658 Bytes
Contents
require 'artoo' connection :sphero, :adaptor => :sphero, :port => '127.0.0.1:4560' device :sphero, :driver => :sphero connection :arduino, :adaptor => :firmata, :port => "8023" device :wiichuck, :driver => :wiichuck, :connection => :arduino, :interval => 0.1 work do init_settings on wiichuck, :c_button => proc {} on wiichuck, :z_button => proc {} on wiichuck, :joystick => proc { |*value| @heading = heading(value[1]) } every(1.seconds) do puts "Rolling..." sphero.roll 20, @heading end end def init_settings @heading = 0 end def heading(value) (180.0 - (Math.atan2(value[:y],value[:x]) * (180.0 / Math::PI))).round end
Version data entries
6 entries across 6 versions & 1 rubygems