Dualshock 3 Controller
Allows user to interact with Cylon.js devices using a Dualshock 3 controller.
How To Connect
Cylon.robot({ connections: { joystick: { adaptor: 'joystick' } }, devices: { controller: { driver: 'dualshock-3' } } });
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: 'dualshock-3' } }, work: function(my) { ["square", "circle", "x", "triangle"].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); }); } }); Cylon.start();
Events
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.
r1:press
Gets triggered when the R1
button on the controller is pressed.
square:press
Gets triggered when the square
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.
l1:press
Gets triggered when the l1
button on the controller is pressed.
l2:press
Gets triggered when the l2
button on the controller is pressed.
r1:press
Gets triggered when the r1
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.
r1:release
Gets triggered when the R1
button on the controller is released.
square:release
Gets triggered when the square
button on the controller is released.
triangle:release
Gets triggered when the triangle
button on the controller is released.
circle:release
Gets triggered when the circle
button on the controller is released.
x:release
Gets triggered when the x
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.
l1:release
Gets triggered when the l1
button on the controller is released.
l2:release
Gets triggered when the l2
button on the controller is released.
r1:release
Gets triggered when the r1
button on the controller is released.
r2:release
Gets triggered when the r2
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.