Skip to content

Commit

Permalink
Update Thermometer examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dtex committed Aug 23, 2019
1 parent 08ba5b7 commit cd7d833
Show file tree
Hide file tree
Showing 48 changed files with 470 additions and 382 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -173,7 +173,7 @@ To get you up and running quickly, we provide a variety of examples for using ea

To interactively navigate the examples, visit the [Johnny-Five examples](http://johnny-five.io/examples/) page on the official website. If you want to link directly to the examples in this repo, you can use one of the following links.

**There are presently 361 example programs with code and diagrams!**
**There are presently 362 example programs with code and diagrams!**

<!--extract-start:examples-->

Expand Down Expand Up @@ -438,6 +438,7 @@ To interactively navigate the examples, visit the [Johnny-Five examples](http://
- [Thermometer - DHT21_I2C_NANO_BACKPACK](https://github.com/rwaldron/johnny-five/blob/master/docs/temperature-DHT21_I2C_NANO_BACKPACK.md)
- [Thermometer - DHT22_I2C_NANO_BACKPACK](https://github.com/rwaldron/johnny-five/blob/master/docs/temperature-DHT22_I2C_NANO_BACKPACK.md)
- [Thermometer - DS18B20](https://github.com/rwaldron/johnny-five/blob/master/docs/temperature-ds18b20.md)
- [Thermometer - Dual DS18B20](https://github.com/rwaldron/johnny-five/blob/master/docs/temperature-dual-ds18b20.md)
- [Thermometer - HIH6130](https://github.com/rwaldron/johnny-five/blob/master/docs/temperature-HIH6130.md)
- [Thermometer - HTU21D](https://github.com/rwaldron/johnny-five/blob/master/docs/temperature-htu21d.md)
- [Thermometer - LM335](https://github.com/rwaldron/johnny-five/blob/master/docs/temperature-lm335.md)
Expand Down
20 changes: 10 additions & 10 deletions docs/temperature-BMP180.md
Expand Up @@ -29,21 +29,21 @@ node eg/temperature-BMP180.js


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

board.on("ready", function() {
var thermometer = new five.Thermometer({
board.on("ready", () => {
const thermometer = new Thermometer({
controller: "BMP180",
freq: 250
});

thermometer.on("change", function() {
console.log("Thermometer");
console.log(" celsius : ", this.celsius);
console.log(" fahrenheit : ", this.fahrenheit);
console.log(" kelvin : ", this.kelvin);
console.log("--------------------------------------");
thermometer.on("change", () => {
console.log(`Thermometer
celsius : ${thermometer.celsius}
fahrenheit : ${thermometer.fahrenheit}
kelvin : ${thermometer.kelvin}
--------------------------------------`);
});
});

Expand Down
20 changes: 10 additions & 10 deletions docs/temperature-DHT11_I2C_NANO_BACKPACK.md
Expand Up @@ -29,20 +29,20 @@ node eg/temperature-DHT11_I2C_NANO_BACKPACK.js


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

board.on("ready", function() {
var thermometer = new five.Thermometer({
board.on("ready", () => {
const thermometer = new Thermometer({
controller: "DHT11_I2C_NANO_BACKPACK"
});

thermometer.on("change", function() {
console.log("Thermometer");
console.log(" celsius : ", this.celsius);
console.log(" fahrenheit : ", this.fahrenheit);
console.log(" kelvin : ", this.kelvin);
console.log("--------------------------------------");
thermometer.on("change", () => {
console.log(`Thermometer
celsius : ${thermometer.celsius}
fahrenheit : ${thermometer.fahrenheit}
kelvin : ${thermometer.kelvin}
--------------------------------------`);
});
});

Expand Down
20 changes: 10 additions & 10 deletions docs/temperature-DHT21_I2C_NANO_BACKPACK.md
Expand Up @@ -29,20 +29,20 @@ node eg/temperature-DHT21_I2C_NANO_BACKPACK.js


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

board.on("ready", function() {
var thermometer = new five.Thermometer({
board.on("ready", () => {
const thermometer = new Thermometer({
controller: "DHT21_I2C_NANO_BACKPACK"
});

thermometer.on("change", function() {
console.log("Thermometer");
console.log(" celsius : ", this.celsius);
console.log(" fahrenheit : ", this.fahrenheit);
console.log(" kelvin : ", this.kelvin);
console.log("--------------------------------------");
thermometer.on("change", () => {
console.log(`Thermometer");
celsius : ${thermometer.celsius}
fahrenheit : ${thermometer.fahrenheit}
kelvin : ${thermometer.kelvin}
--------------------------------------`);
});
});

Expand Down
20 changes: 10 additions & 10 deletions docs/temperature-DHT22_I2C_NANO_BACKPACK.md
Expand Up @@ -29,20 +29,20 @@ node eg/temperature-DHT22_I2C_NANO_BACKPACK.js


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

board.on("ready", function() {
var thermometer = new five.Thermometer({
board.on("ready", () => {
const thermometer = new Thermometer({
controller: "DHT22_I2C_NANO_BACKPACK"
});

thermometer.on("change", function() {
console.log("Thermometer");
console.log(" celsius : ", this.celsius);
console.log(" fahrenheit : ", this.fahrenheit);
console.log(" kelvin : ", this.kelvin);
console.log("--------------------------------------");
thermometer.on("change", () => {
console.log(`Thermometer
celsius : ${thermometer.celsius}
fahrenheit : ${thermometer.fahrenheit}
kelvin : ${thermometer.kelvin}
--------------------------------------`);
});
});

Expand Down
20 changes: 10 additions & 10 deletions docs/temperature-HIH6130.md
Expand Up @@ -29,20 +29,20 @@ node eg/temperature-HIH6130.js


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

board.on("ready", function() {
var thermometer = new five.Thermometer({
board.on("ready", () => {
const thermometer = new Thermometer({
controller: "HIH6130"
});

thermometer.on("change", function() {
console.log("Thermometer");
console.log(" celsius : ", this.celsius);
console.log(" fahrenheit : ", this.fahrenheit);
console.log(" kelvin : ", this.kelvin);
console.log("--------------------------------------");
thermometer.on("change", () => {
console.log(`Thermometer
celsius : ${thermometer.celsius}
fahrenheit : ${thermometer.fahrenheit}
kelvin : ${thermometer.kelvin}
--------------------------------------`);
});
});

Expand Down
20 changes: 10 additions & 10 deletions docs/temperature-MCP9808.md
Expand Up @@ -29,20 +29,20 @@ node eg/temperature-MCP9808.js


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

board.on("ready", function() {
var thermometer = new five.Thermometer({
board.on("ready", () => {
const thermometer = new Thermometer({
controller: "MCP9808"
});

thermometer.on("change", function() {
console.log("Thermometer");
console.log(" celsius : ", this.celsius);
console.log(" fahrenheit : ", this.fahrenheit);
console.log(" kelvin : ", this.kelvin);
console.log("--------------------------------------");
thermometer.on("change", () => {
console.log(`Thermometer
celsius : ${thermometer.celsius}
fahrenheit : ${thermometer.fahrenheit}
kelvin : ${thermometer.kelvin}
--------------------------------------`);
});
});

Expand Down
20 changes: 10 additions & 10 deletions docs/temperature-MS5611.md
Expand Up @@ -29,20 +29,20 @@ node eg/temperature-MS5611.js


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

board.on("ready", function() {
var thermometer = new five.Thermometer({
board.on("ready", () => {
const thermometer = new Thermometer({
controller: "MS5611"
});

thermometer.on("change", function() {
console.log("Thermometer");
console.log(" celsius : ", this.celsius);
console.log(" fahrenheit : ", this.fahrenheit);
console.log(" kelvin : ", this.kelvin);
console.log("--------------------------------------");
thermometer.on("change", () => {
console.log(`Thermometer
celsius : ${thermometer.celsius}
fahrenheit : ${thermometer.fahrenheit}
kelvin : ${thermometer.kelvin}
--------------------------------------`);
});
});

Expand Down
15 changes: 8 additions & 7 deletions docs/temperature-SI7020.md
Expand Up @@ -29,20 +29,21 @@ node eg/temperature-SI7020.js


```javascript
var five = require("../");
var Tessel = require("tessel-io");
var board = new five.Board({
const {Board, Thermometer} = require("johnny-five");
const Tessel = require("tessel-io");

const board = new Board({
io: new Tessel()
});

board.on("ready", function() {
var temp = new five.Thermometer({
board.on("ready", () => {
const temp = new Thermometer({
controller: "SI7020",
port: "A"
});

temp.on("change", function() {
console.log(this.celsius + "°C", this.fahrenheit + "°F");
temp.on("change", () => {
console.log(`${temp.celsius}°C ${temp.fahrenheit}°F`);
});
});

Expand Down
15 changes: 8 additions & 7 deletions docs/temperature-SI7021.md
Expand Up @@ -29,20 +29,21 @@ node eg/temperature-SI7021.js


```javascript
var five = require("../");
var Tessel = require("tessel-io");
var board = new five.Board({
const {Board, Thermometer} = require("johnny-five");
const Tessel = require("tessel-io");

const board = new Board({
io: new Tessel()
});

board.on("ready", function() {
var temp = new five.Thermometer({
board.on("ready", () => {
const temp = new Thermometer({
controller: "SI7021",
port: "A"
});

temp.on("change", function() {
console.log(this.celsius + "°C", this.fahrenheit + "°F");
temp.on("change", () => {
console.log(`${temp.celsius}°C ${temp.fahrenheit}°F`);
});
});

Expand Down
20 changes: 10 additions & 10 deletions docs/temperature-TH02.md
Expand Up @@ -18,20 +18,20 @@ node eg/temperature-TH02.js


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

board.on("ready", function() {
var thermometer = new five.Thermometer({
board.on("ready", () => {
const thermometer = new Thermometer({
controller: "TH02"
});

thermometer.on("change", function() {
console.log("Thermometer");
console.log(" celsius : ", this.celsius);
console.log(" fahrenheit : ", this.fahrenheit);
console.log(" kelvin : ", this.kelvin);
console.log("--------------------------------------");
thermometer.on("change", () => {
console.log(`Thermometer
celsius : ${thermometer.celsius}
fahrenheit : ${thermometer.fahrenheit}
kelvin : ${thermometer.kelvin}
--------------------------------------`);
});
});

Expand Down
20 changes: 10 additions & 10 deletions docs/temperature-bmp085.md
Expand Up @@ -29,20 +29,20 @@ node eg/temperature-bmp085.js


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

board.on("ready", function() {
var temp = new five.Thermometer({
board.on("ready", () => {
const temp = new Thermometer({
controller: "BMP085"
});

temp.on("change", function() {
console.log("Thermometer");
console.log(" celsius : ", this.celsius);
console.log(" fahrenheit : ", this.fahrenheit);
console.log(" kelvin : ", this.kelvin);
console.log("--------------------------------------");
temp.on("change", () => {
console.log(`Thermometer
celsius : ${temp.celsius}
fahrenheit : ${temp.fahrenheit}
kelvin : ${temp.kelvin}
--------------------------------------`);
});
});

Expand Down
14 changes: 7 additions & 7 deletions docs/temperature-ds18b20.md
Expand Up @@ -29,18 +29,18 @@ node eg/temperature-ds18b20.js


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

board.on("ready", function() {
// This requires OneWire support using the ConfigurableFirmata
var thermometer = new five.Thermometer({
board.on("ready", () => {
// This requires OneWire support using ConfigurableFirmata
const thermometer = new Thermometer({
controller: "DS18B20",
pin: 2
});

thermometer.on("change", function() {
console.log(this.celsius + "°C");
thermometer.on("change", () => {
console.log(`${thermometer.celsius}°C`);
// console.log("0x" + this.address.toString(16));
});
});
Expand Down

0 comments on commit cd7d833

Please sign in to comment.