@@ -11,38 +11,42 @@ Mac OSX driver: http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/O
1111
1212## Usage
1313
14- var XboxController = require('xbox-controller');
15- var xbox = new XboxController;
14+ ``` javascript
15+ var XboxController = require (' xbox-controller' );
16+ var xbox = new XboxController ;
1617
17- xbox.on('a:press', function (key) {
18- console.log(key + ' press');
19- });
18+ xbox .on (' a:press' , function (key ) {
19+ console .log (key + ' press' );
20+ });
2021
21- xbox.on('b:release', function (key) {
22- console.log(key+' release');
23- });
22+ xbox .on (' b:release' , function (key ) {
23+ console .log (key+ ' release' );
24+ });
2425
25- xbox.on('lefttrigger', function(position){
26- console.log('lefttrigger', position);
27- });
26+ xbox .on (' lefttrigger' , function (position ){
27+ console .log (' lefttrigger' , position);
28+ });
2829
29- xbox.on('righttrigger', function(position){
30- console.log('righttrigger', position);
31- });
30+ xbox .on (' righttrigger' , function (position ){
31+ console .log (' righttrigger' , position);
32+ });
3233
33- xbox.on('left:move', function(position){
34- console.log('left:move', position);
35- });
34+ xbox .on (' left:move' , function (position ){
35+ console .log (' left:move' , position);
36+ });
3637
37- xbox.on('right:move', function(position){
38- console.log('right:move', position);
39- });
38+ xbox .on (' right:move' , function (position ){
39+ console .log (' right:move' , position);
40+ });
41+ ```
4042
4143## LEDs
4244
4345Set LED pattern on controller:
4446
45- xbox.setLed(0x0A);
47+ ``` javascript
48+ xbox .setLed (0x0A );
49+ ```
4650
4751Available LED patterns:
4852
@@ -65,10 +69,12 @@ Available LED patterns:
6569
6670Control left and right rumble motors:
6771
68- var leftStrength = 255;
69- var rightStrength = 255;
72+ ``` javascript
73+ var leftStrength = 255 ;
74+ var rightStrength = 255 ;
7075
71- xbox.rumble(leftStrength, rightStrength);
76+ xbox .rumble (leftStrength, rightStrength);
77+ ```
7278
7379Where the strengths are between 0 and 255.
7480
@@ -86,13 +92,17 @@ xbox.within('righttrigger', [50,100], function(err, data){
8692
8793If you have a third party controller with a different name you can specify the name when creating the controller:
8894
89- var xbox = new XboxController('flight stick');
95+ ``` javascript
96+ var xbox = new XboxController (' flight stick' );
97+ ```
9098
9199## Configuring a Third Party Controller
92100
93101To configure a third party controller:
94102
95- XboxController.configure();
103+ ``` javascript
104+ XboxController .configure ();
105+ ```
96106
97107## Copyright
98108
0 commit comments