Skip to content

Commit

Permalink
Examples: regenerate
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Sep 17, 2019
1 parent f3ddbb5 commit 4b65604
Show file tree
Hide file tree
Showing 57 changed files with 253 additions and 243 deletions.
2 changes: 1 addition & 1 deletion docs/accelerometer-LIS3DH.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/accelerometer-LIS3DH.js


```javascript
const {Accelerometer, Board} = require("johnny-five");
const { Accelerometer, Board } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/accelerometer-MMA8452.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/accelerometer-MMA8452.js


```javascript
const {Accelerometer, Board} = require("johnny-five");
const { Accelerometer, Board } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/accelerometer-adxl335.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/accelerometer-adxl335.js


```javascript
const {Accelerometer, Board} = require("johnny-five");
const { Accelerometer, Board } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/accelerometer-adxl345.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/accelerometer-adxl345.js


```javascript
const {Accelerometer, Board} = require("johnny-five");
const { Accelerometer, Board } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/accelerometer-mma7361.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/accelerometer-mma7361.js


```javascript
const {Accelerometer, Board} = require("johnny-five");
const { Accelerometer, Board } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/accelerometer-mpu6050.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/accelerometer-mpu6050.js


```javascript
const {Accelerometer, Board} = require("johnny-five");
const { Accelerometer, Board } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/accelerometer-pan-tilt.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ node eg/accelerometer-pan-tilt.js


```javascript
const {Accelerometer, Board, Servo, Servos} = require("johnny-five");
const { Accelerometer, Board, Servo, Servos } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/accelerometer.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/accelerometer.js


```javascript
const {Accelerometer, Board} = require("johnny-five");
const { Accelerometer, Board } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/barometer-BMP085.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/barometer-BMP085.js


```javascript
const {Barometer, Board} = require("johnny-five");
const { Barometer, Board } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/barometer-BMP180.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/barometer-BMP180.js


```javascript
const {Barometer, Board} = require("johnny-five");
const { Barometer, Board } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/barometer-MS5611.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/barometer-MS5611.js


```javascript
const {Barometer, Board} = require("johnny-five");
const { Barometer, Board } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/barometer-mpl115a2.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/barometer-mpl115a2.js


```javascript
const {Barometer, Board} = require("johnny-five");
const { Barometer, Board } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/barometer-mpl3115a2.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/barometer-mpl3115a2.js


```javascript
const {Barometer, Board} = require("johnny-five");
const { Barometer, Board } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
10 changes: 5 additions & 5 deletions docs/board-cleanup.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ node eg/board-cleanup.js


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

board.on("ready", function() {
var led = new five.Led(13);
board.on("ready", () => {
const led = new Led(13);
led.on();


this.on("exit", function() {
board.on("exit", () => {
led.off();
});
});
Expand Down
14 changes: 7 additions & 7 deletions docs/board-multi.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ node eg/board-multi.js


```javascript
var five = require("johnny-five");
var boards = new five.Boards(["A", "B"]);
const { Boards, Led } = require("johnny-five");
const boards = new Boards(["A", "B"]);

// Create 2 board instances with IDs "A" & "B"
boards.on("ready", function() {
Expand All @@ -39,22 +39,22 @@ boards.on("ready", function() {
// (connected and available for communication)

// Access them by their ID:
var led = new five.Led({
const led = new Led({
board: board.byId("A"),
pin: 13,
board: this.byId("A")
});

led.blink();

// |this| is an array-like object containing references
// to each initialized board.
this.each(function(board) {
boards.each(board => {
if (board.id === "B") {
// Initialize an Led instance on pin 13 of
// each initialized board and strobe it.
var led = new five.Led({
const led = new Led({
pin: 13,
board: board
board
});

led.blink();
Expand Down
8 changes: 4 additions & 4 deletions docs/board-sampling-interval.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ node eg/board-sampling-interval.js


```javascript
var five = require("johnny-five");
var board = new five.Board();
const { Board } = require("johnny-five");
const board = new Board();

board.on("ready", function() {
board.on("ready", () => {

// Use the board's `samplingInterval(ms)` to
// control the actual MCU sampling rate.
//
// This will limit sampling of all Analog Input
// and I2C sensors to once per second (1000 milliseconds)
this.samplingInterval(1000);
board.samplingInterval(1000);


// Keep in mind that calling this method
Expand Down
12 changes: 6 additions & 6 deletions docs/board-with-port.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ node eg/board-with-port.js


```javascript
var five = require("johnny-five");
const { Board } = require("johnny-five");

// Johnny-Five will try its hardest to detect the port for you,
// however you may also explicitly specify the port by passing
// it as an optional property to the Board constructor:
var board = new five.Board({
const board = new Board({
port: "/dev/cu.usbmodem1411"
});

// The board's pins will not be accessible until
// the board has reported that it is ready
board.on("ready", function() {
this.pinMode(13, this.MODES.OUTPUT);
board.on("ready", () => {
board.pinMode(13, board.MODES.OUTPUT);

this.loop(500, () => {
board.loop(500, () => {
// Whatever the last value was, write the opposite
this.digitalWrite(13, this.pins[13].value ? 0 : 1);
board.digitalWrite(13, board.pins[13].value ? 0 : 1);
});
});

Expand Down
8 changes: 4 additions & 4 deletions docs/board.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ node eg/board.js


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

// The board's pins will not be accessible until
// the board has reported that it is ready
board.on("ready", function() {
board.on("ready", () => {
console.log("Ready!");

var led = new five.Led(13);
const led = new five.Led(13);
led.blink(500);
});

Expand Down
2 changes: 1 addition & 1 deletion docs/compass-MAG3110-tessel.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ node eg/compass-MAG3110-tessel.js

```javascript
const Tessel = require("tessel-io");
const {Board, Compass} = require("johnny-five");
const { Board, Compass } = require("johnny-five");
const board = new Board({
io: new Tessel()
});
Expand Down
2 changes: 1 addition & 1 deletion docs/compass-MAG3110.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/compass-MAG3110.js


```javascript
const {Board, Compass} = require("johnny-five");
const { Board, Compass } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/compass-hmc5883l.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/compass-hmc5883l.js


```javascript
const {Board, Compass} = require("johnny-five");
const { Board, Compass } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/compass-hmc6352.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ node eg/compass-hmc6352.js


```javascript
const {Board, Compass} = require("johnny-five");
const { Board, Compass } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
Expand Down
10 changes: 5 additions & 5 deletions docs/edison-io-arduino.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ node eg/edison-io-arduino.js


```javascript
var five = require("johnny-five");
var Edison = require("edison-io");
var board = new five.Board({
const { Board, Led } = require("johnny-five");
const Edison = require("edison-io");
const board = new five.Board({
io: new Edison()
});

board.on("ready", function() {
var led = new five.Led(13);
board.on("ready", () => {
const led = new Led(13);
led.blink();
});

Expand Down
10 changes: 5 additions & 5 deletions docs/edison-io-miniboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ node eg/edison-io-miniboard.js


```javascript
var five = require("johnny-five");
var Edison = require("edison-io");
var board = new five.Board({
const { Board, Led } = require("johnny-five");
const Edison = require("edison-io");
const board = new five.Board({
io: new Edison()
});

board.on("ready", function() {
var led = new five.Led(1);
board.on("ready", () => {
const led = new Led(1);
led.blink();
});

Expand Down
23 changes: 14 additions & 9 deletions docs/expander-74HC595.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ node eg/expander-74HC595.js


```javascript
var five = require("johnny-five");
var board = new five.Board();
const { Board, Expander, Leds } = require("johnny-five");
const board = new Board();

board.on("ready", function() {
var expander = new five.Expander({
board.on("ready", () => {
const expander = new Expander({
controller: "74HC595",
pins: {
data: 2,
Expand All @@ -44,13 +44,18 @@ board.on("ready", function() {
}
});

var virtual = new five.Board.Virtual(expander);
var leds = new five.Leds({
pins: [0, 1, 2, 3, 4, 5, 6, 7],
board: virtual
});
const virtual = new Board.Virtual(expander);
const leds = new Leds(
Array.from(Array(8), (_, pin) =>
({ pin, board: virtual })
)
);

leds.blink(500);

board.repl.inject({
leds
});
});

```
Expand Down
Loading

0 comments on commit 4b65604

Please sign in to comment.