File tree 3 files changed +9
-11
lines changed
3 files changed +9
-11
lines changed Original file line number Diff line number Diff line change 1
1
const { Board, Leds} = require ( "../lib/johnny-five.js" ) ;
2
2
const board = new Board ( ) ;
3
3
4
- board . on ( "ready" , function ( ) {
4
+ board . on ( "ready" , ( ) => {
5
5
const array = new Leds ( [ 3 , 5 , 6 ] ) ;
6
6
7
7
array . pulse ( ) ;
Original file line number Diff line number Diff line change 3
3
// Led.isOn, and Led.isRunning following a variety
4
4
// of Led method calls.
5
5
//
6
- var five = require ( "../lib/johnny-five.js" ) ;
7
- var board = new five . Board ( ) ;
6
+ const { Board , Led } = require ( "../lib/johnny-five.js" ) ;
7
+ const board = new Board ( ) ;
8
8
9
- board . on ( "ready" , function ( ) {
9
+ board . on ( "ready" , ( ) => {
10
10
// Default to pin 11 (must be PWM)
11
- var led = new five . Led ( process . argv [ 2 ] || 11 ) ;
11
+ const led = new Led ( process . argv [ 2 ] || 11 ) ;
12
12
13
- this . repl . inject ( {
14
- led : led
15
- } ) ;
13
+ board . repl . inject ( { led } ) ;
16
14
17
15
// Print defaut status
18
16
console . log ( "default status" ) ;
@@ -40,7 +38,7 @@ board.on("ready", function() {
40
38
status ( ) ;
41
39
42
40
// Wait 3 seconds, stop, and print status
43
- this . wait ( 3000 , function ( ) {
41
+ board . wait ( 3000 , ( ) => {
44
42
console . log ( "led.stop()" ) ;
45
43
led . stop ( ) ;
46
44
// Note that value/isOn will reflect the state of
Original file line number Diff line number Diff line change 1
1
const { Board, Led} = require ( "../lib/johnny-five.js" ) ;
2
2
const board = new Board ( ) ;
3
3
4
- board . on ( "ready" , function ( ) {
4
+ board . on ( "ready" , ( ) => {
5
5
const led = new Led ( 13 ) ;
6
6
7
7
// This will grant access to the led instance
8
8
// from within the REPL that's created when
9
9
// running this program.
10
- this . repl . inject ( {
10
+ board . repl . inject ( {
11
11
led
12
12
} ) ;
13
13
You can’t perform that action at this time.
0 commit comments