Xbox 360 Controller
Allows user to interact with Cylon.js devices using a Xbox 360 controller.
How To Connect
Cylon.robot({ connections: { joystick: { adaptor: 'joystick' } }, devices: { controller: { driver: 'xbox-360' } } });
How To Use
What follows is an example of button and joystick input for the DualShock 3.
var Cylon = require('cylon'); Cylon.robot({ connections: { joystick: { adaptor: 'joystick' } }, devices: { controller: { driver: 'xbox-360' } }, work: function(my) { ["a", "b", "x", "y"].forEach(function(button) { my.controller.on(button + ":press", function() { console.log("Button " + button + " pressed."); }); my.controller.on(button + ":release", function() { console.log("Button " + button + " released."); }); }); my.controller.on("left_x:move", function(pos) { console.log("Left Stick - X:", pos); }); my.controller.on("left_y:move", function(pos) { console.log("Left Stick - Y:", pos); }); my.controller.on("right_x:move", function(pos) { console.log("Right Stick - X:", pos); }); my.controller.on("right_y:move", function(pos) { console.log("Right Stick - Y:", pos); }); my.controller.on("lt:move", function(pos) { console.log("Left Trigger: ", pos); }); my.controller.on("rt:move", function(pos) { console.log("Right Trigger: ", pos); }); } }); Cylon.start();
Events
lt:move
Gets triggered when the left trigger is moved.
rt:move
Gets triggered when the right trigger is moved.
left_x:move
Gets triggered when the left stick is moved on the X axis.
left_y:move
Gets triggered when the left stick is moved on the Y axis.
right_x:move
Gets triggered when the right stick is moved on the X axis.
right_y:move
Gets triggered when the right stick is moved on the Y axis.
rb:press
Gets triggered when the RB
button on the controller is pressed.
x:press
Gets triggered when the x
button on the controller is pressed.
triangle:press
Gets triggered when the triangle
button on the controller is pressed.
circle:press
Gets triggered when the circle
button on the controller is pressed.
x:press
Gets triggered when the x
button on the controller is pressed.
up:press
Gets triggered when the up
button on the d-pad is pressed.
down:press
Gets triggered when the down
button on the d-pad is pressed.
left:press
Gets triggered when the left
button on the d-pad is pressed.
right:press
Gets triggered when the right
button on the d-pad is pressed.
left_stick:press
Gets triggered when the controller's left stick is pressed.
right_stick:press
Gets triggered when the controller's right stick is pressed.
lb:press
Gets triggered when the lb
button on the controller is pressed.
l2:press
Gets triggered when the l2
button on the controller is pressed.
rb:press
Gets triggered when the rb
button on the controller is pressed.
r2:press
Gets triggered when the r2
button on the controller is pressed.
start:press
Gets triggered when the start
button on the controller is pressed.
select:press
Gets triggered when the select
button on the controller is pressed.
home:press
Gets triggered when the home
button on the controller is pressed.
rb:release
Gets triggered when the RB
button on the controller is released.
x:release
Gets triggered when the x
button on the controller is released.
y:release
Gets triggered when the y
button on the controller is released.
b:release
Gets triggered when the b
button on the controller is released.
a:release
Gets triggered when the a
button on the controller is released.
up:release
Gets triggered when the up
button on the d-pad is released.
down:release
Gets triggered when the down
button on the d-pad is released.
left:release
Gets triggered when the left
button on the d-pad is released.
right:release
Gets triggered when the right
button on the d-pad is released.
left_stick:release
Gets triggered when the controller's left stick is released.
right_stick:release
Gets triggered when the controller's right stick is released.
lb:release
Gets triggered when the lb
button on the controller is released.
rb:release
Gets triggered when the rb
button on the controller is released.
start:release
Gets triggered when the start
button on the controller is released.
select:release
Gets triggered when the select
button on the controller is released.
home:release
Gets triggered when the home
button on the controller is released.