Drivers

Artoo has a extensible system for connecting to hardware devices.

XBox360 Controller


Allows user to interact with Artoo devices using a XBox360 game controller.

How To Connect

require 'artoo'
connection :joystick, :adaptor => :joystick
device :controller, :driver => :xbox360, :connection => :joystick, :interval => 0.1

How To Use

How to use events and call them on your drivers

Pretty simple, when the connection and the driver have been setup (as explained above) you can call events on them as follows:

on controller, :button_a => proc { |*value| puts "ayyyy!" }

Example receiving button events from XBox360 controller joystick.

require 'artoo'

connection :joystick, :adaptor => :joystick
device :controller, :driver => :xbox360, :connection => :joystick, :interval => 0.1

work do
  on controller, :joystick_0 => proc { |*value|
    puts "joystick 0 - x:#{value[1][:x]} y:#{value[1][:y]}"
  }
  on controller, :joystick_1 => proc { |*value|
    puts "joystick 1 - x:#{value[1][:x]} y:#{value[1][:y]}"
  }
  on controller, :button_a => proc { |*value|
    puts "ayyyy!"
  }
  on controller, :button_b => proc { |*value|
    puts "bee!"
  }
  on controller, :button_x => proc { |*value|
    puts "exxx!"
  }
  on controller, :button_y => proc { |*value|
    puts "why!"
  }
end

Events

button_a

Gets triggered every interval amount of time if the a button is pressed.

button_b

Gets triggered every interval amount of time if the b button is pressed.

button_x

Gets triggered every interval amount of time if the x button is pressed.

button_y

Gets triggered every interval amount of time if the y button is pressed.

button_lb

Gets triggered every interval amount of time if the left bumper button is pressed.

button_rb

Gets triggered every interval amount of time if the right bumper button is pressed.

button_start

Gets triggered every interval amount of time if the start button is pressed.

button_back

Gets triggered every interval amount of time if the back button is pressed.

joystick

Gets triggered every interval amount of time if a joystick event occured, you can access values x, y, s(joystick number, 0 and 1 for left and right).

joystick_0

Get's triggered every interval amount of time if a joystick_0 event occured, you can access values x, y.

joystick_1

Gets triggered every interval amount of time if a joystick_1 event occured, you can access values x, y.

Compatibility