Skip to content
This repository was archived by the owner on Dec 20, 2018. It is now read-only.

Commit 4505dce

Browse files
author
Andrew Nesbitt
committed
Javascript syntax highlighting
1 parent 54ea9e4 commit 4505dce

File tree

1 file changed

+36
-26
lines changed

1 file changed

+36
-26
lines changed

Readme.md

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -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

4345
Set LED pattern on controller:
4446

45-
xbox.setLed(0x0A);
47+
```javascript
48+
xbox.setLed(0x0A);
49+
```
4650

4751
Available LED patterns:
4852

@@ -65,10 +69,12 @@ Available LED patterns:
6569

6670
Control 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

7379
Where the strengths are between 0 and 255.
7480

@@ -86,13 +92,17 @@ xbox.within('righttrigger', [50,100], function(err, data){
8692

8793
If 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

93101
To configure a third party controller:
94102

95-
XboxController.configure();
103+
```javascript
104+
XboxController.configure();
105+
```
96106

97107
## Copyright
98108

0 commit comments

Comments
 (0)