examples/dualshock3/dualshock3.js
"use strict";
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("right_x:move", function(pos) {
console.log("Right Stick - X:", pos);
});
my.controller.on("left_y:move", function(pos) {
console.log("Left Stick - Y:", pos);
});
my.controller.on("right_y:move", function(pos) {
console.log("Right Stick - Y:", pos);
});
}
}).start();