Drivers

Artoo has a extensible system for connecting to hardware devices.

Playstation3 Controller


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

How To Connect

require 'artoo'
connection :joystick, :adaptor => :joystick
device :controller, :driver => :ps3, :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 joystick, :joystick => proc { |caller, value|
  puts 'joystick ' + value[:s].to_s, value[:x], value[:y]
}

Example receiving button events from PS3 controller joystick.

require 'artoo'

connection :joystick, :adaptor => :joystick
device :joystick, :driver => :ps3, :connection => :joystick, :interval => 0.1

work do
  on joystick, :joystick => proc { |caller, value|
    puts 'joystick ' + value[:s].to_s, value[:x], value[:y]
  }
  on joystick, :button_triangle => proc { |*value|
    puts 'triangle button'
  }
end

Events

button_left_joystick

Gets triggered every interval amount of time if a left joystick click event occured.

button_right_joystick

Gets triggered every interval amount of time if a right joystick click event occured.

button_square

Gets triggered every interval amount of time if the square button was pressed.

button_x

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

button_circle

Gets triggered every interval amount of time if the circle button was pressed.

button_triangle

Gets triggered every interval amount of time if the triangle button was pressed.

button_l1

Gets triggered every interval amount of time if the l1 button was pressed.

button_l2

Gets triggered every interval amount of time if the l2 button was pressed.

button_r1

Gets triggered every interval amount of time if the r1 button was pressed.

button_r2

Gets triggered every interval amount of time if the r2 button was pressed.

button_start

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

button_select

Gets triggered every interval amount of time if the select button was pressed.

button_home

Gets triggered every interval amount of time if the home button was 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

Gets 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