Skip to content

Commit 507c5c0

Browse files
ryanjgilldtex
authored andcommitted
Examples: update led (#1598)
* Examples: update led syntax * Docs: build docs from example * remove arrow function to allow this to scope to board
1 parent 375b472 commit 507c5c0

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

docs/led.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,22 @@ node eg/led.js
3333

3434

3535
```javascript
36-
var five = require("johnny-five");
37-
var board = new five.Board();
36+
const {Board, Led} = require("johnny-five");
37+
const board = new Board();
3838

39-
board.on("ready", function() {
40-
var led = new five.Led(13);
39+
board.on("ready", function () {
40+
const led = new Led(13);
4141

4242
// This will grant access to the led instance
4343
// from within the REPL that's created when
4444
// running this program.
4545
this.repl.inject({
46-
led: led
46+
led
4747
});
4848

4949
led.blink();
5050
});
5151

52-
5352
```
5453

5554

eg/led.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
var five = require("../lib/johnny-five.js");
2-
var board = new five.Board();
1+
const {Board, Led} = require("../lib/johnny-five.js");
2+
const board = new Board();
33

4-
board.on("ready", function() {
5-
var led = new five.Led(13);
4+
board.on("ready", function () {
5+
const led = new Led(13);
66

77
// This will grant access to the led instance
88
// from within the REPL that's created when
99
// running this program.
1010
this.repl.inject({
11-
led: led
11+
led
1212
});
1313

1414
led.blink();
1515
});
16-
1716
/* @markdown
1817
This script will make `led` available in the REPL, by default on pin 13.
1918
Now you can try, e.g.:

0 commit comments

Comments
 (0)