Permalink
Browse files

Multi: DHT11 refactored to support DHT11, 21, 22. Fixes gh-1216, gh-112

  • Loading branch information...
1 parent 71383d2 commit d75ac0c38ddb21608be00db8d1ea20bdfb1b3933 @rwaldron committed Oct 14, 2016
View
@@ -372,6 +372,7 @@ To interactively navigate the examples, visit the [Johnny-Five examples](http://
- [Multi - BMP085](https://github.com/rwaldron/johnny-five/blob/master/docs/multi-bmp085.md)
- [Multi - BMP180](https://github.com/rwaldron/johnny-five/blob/master/docs/multi-bmp180.md)
- [Multi - DHT11_I2C_NANO_BACKPACK](https://github.com/rwaldron/johnny-five/blob/master/docs/multi-DHT11_I2C_NANO_BACKPACK.md)
+- [Multi - DHT22_I2C_NANO_BACKPACK](https://github.com/rwaldron/johnny-five/blob/master/docs/multi-DHT22_I2C_NANO_BACKPACK.md)
- [Multi - HIH6130](https://github.com/rwaldron/johnny-five/blob/master/docs/multi-HIH6130.md)
- [Multi - HTU21D](https://github.com/rwaldron/johnny-five/blob/master/docs/multi-htu21d.md)
- [Multi - MPL115A2](https://github.com/rwaldron/johnny-five/blob/master/docs/multi-mpl115a2.md)
@@ -403,6 +404,7 @@ To interactively navigate the examples, visit the [Johnny-Five examples](http://
- [Gyro - Analog LPR5150AL](https://github.com/rwaldron/johnny-five/blob/master/docs/gyro-lpr5150l.md)
- [Gyro - I2C MPU6050](https://github.com/rwaldron/johnny-five/blob/master/docs/gyro-mpu6050.md)
- [Hygrometer - DHT11_I2C_NANO_BACKPACK](https://github.com/rwaldron/johnny-five/blob/master/docs/hygrometer-DHT11_I2C_NANO_BACKPACK.md)
+- [Hygrometer - DHT22_I2C_NANO_BACKPACK](https://github.com/rwaldron/johnny-five/blob/master/docs/hygrometer-DHT22_I2C_NANO_BACKPACK.md)
- [Hygrometer - HIH6130](https://github.com/rwaldron/johnny-five/blob/master/docs/hygrometer-HIH6130.md)
- [Hygrometer - HTU21D](https://github.com/rwaldron/johnny-five/blob/master/docs/hygrometer-htu21d.md)
- [Hygrometer - SHT31D](https://github.com/rwaldron/johnny-five/blob/master/docs/hygrometer-sht31d.md)
@@ -416,6 +418,7 @@ To interactively navigate the examples, visit the [Johnny-Five examples](http://
- [Thermometer - BMP085](https://github.com/rwaldron/johnny-five/blob/master/docs/temperature-bmp085.md)
- [Thermometer - BMP180](https://github.com/rwaldron/johnny-five/blob/master/docs/temperature-BMP180.md)
- [Thermometer - DHT11_I2C_NANO_BACKPACK](https://github.com/rwaldron/johnny-five/blob/master/docs/temperature-DHT11_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 - 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)
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -56,7 +56,7 @@ board.on("ready", function() {
## Learn More
-- [I2C Backback Firmare](https://github.com/rwaldron/johnny-five/blob/master/firmwares/dht11_i2c_nano_backpack.ino)
+- [I2C Backback Firmare](https://github.com/rwaldron/johnny-five/blob/master/firmwares/dht_i2c_nano_backpack.ino)
 
@@ -0,0 +1,72 @@
+<!--remove-start-->
+
+# Hygrometer - DHT22_I2C_NANO_BACKPACK
+
+<!--remove-end-->
+
+
+
+
+
+
+##### Hygrometer DHT22
+
+
+
+![docs/breadboard/multi-DHT22_I2C_NANO_BACKPACK.png](breadboard/multi-DHT22_I2C_NANO_BACKPACK.png)<br>
+
+Fritzing diagram: [docs/breadboard/multi-DHT22_I2C_NANO_BACKPACK.fzz](breadboard/multi-DHT22_I2C_NANO_BACKPACK.fzz)
+
+&nbsp;
+
+
+
+
+Run this example from the command line with:
+```bash
+node eg/hygrometer-DHT22_I2C_NANO_BACKPACK.js
+```
+
+
+```javascript
+var five = require("../");
+var board = new five.Board();
+
+board.on("ready", function() {
+ var hygrometer = new five.Hygrometer({
+ controller: "DHT22_I2C_NANO_BACKPACK"
+ });
+
+ hygrometer.on("change", function() {
+ console.log("Hygrometer");
+ console.log(" relative humidity : ", this.relativeHumidity);
+ console.log("--------------------------------------");
+ });
+});
+
+
+```
+
+
+
+
+
+
+
+
+
+## Learn More
+
+- [I2C Backback Firmare](https://github.com/rwaldron/johnny-five/blob/master/firmwares/dht_i2c_nano_backpack.ino)
+
+&nbsp;
+
+<!--remove-start-->
+
+## License
+Copyright (c) 2012, 2013, 2014 Rick Waldron <waldron.rick@gmail.com>
+Licensed under the MIT license.
+Copyright (c) 2016 The Johnny-Five Contributors
+Licensed under the MIT license.
+
+<!--remove-end-->
@@ -62,7 +62,7 @@ board.on("ready", function() {
## Learn More
-- [I2C Backback Firmare](https://github.com/rwaldron/johnny-five/blob/master/firmwares/dht11_i2c_nano_backpack.ino)
+- [I2C Backback Firmare](https://github.com/rwaldron/johnny-five/blob/master/firmwares/dht_i2c_nano_backpack.ino)
&nbsp;
@@ -0,0 +1,78 @@
+<!--remove-start-->
+
+# Multi - DHT22_I2C_NANO_BACKPACK
+
+<!--remove-end-->
+
+
+
+
+
+
+##### DHT22
+
+
+
+![docs/breadboard/multi-DHT22_I2C_NANO_BACKPACK.png](breadboard/multi-DHT22_I2C_NANO_BACKPACK.png)<br>
+
+Fritzing diagram: [docs/breadboard/multi-DHT22_I2C_NANO_BACKPACK.fzz](breadboard/multi-DHT22_I2C_NANO_BACKPACK.fzz)
+
+&nbsp;
+
+
+
+
+Run this example from the command line with:
+```bash
+node eg/multi-DHT22_I2C_NANO_BACKPACK.js
+```
+
+
+```javascript
+var five = require("../");
+var board = new five.Board();
+
+board.on("ready", function() {
+ var multi = new five.Multi({
+ controller: "DHT22_I2C_NANO_BACKPACK",
+ pin: 2,
+ });
+
+ multi.on("change", function() {
+ console.log("Thermometer");
+ console.log(" celsius : ", this.thermometer.celsius);
+ console.log(" fahrenheit : ", this.thermometer.fahrenheit);
+ console.log(" kelvin : ", this.thermometer.kelvin);
+ console.log("--------------------------------------");
+
+ console.log("Hygrometer");
+ console.log(" relative humidity : ", this.hygrometer.relativeHumidity);
+ console.log("--------------------------------------");
+ });
+});
+
+```
+
+
+
+
+
+
+
+
+
+## Learn More
+
+- [I2C Backback Firmare](https://github.com/rwaldron/johnny-five/blob/master/firmwares/dht_i2c_nano_backpack.ino)
+
+&nbsp;
+
+<!--remove-start-->
+
+## License
+Copyright (c) 2012, 2013, 2014 Rick Waldron <waldron.rick@gmail.com>
+Licensed under the MIT license.
+Copyright (c) 2016 The Johnny-Five Contributors
+Licensed under the MIT license.
+
+<!--remove-end-->
@@ -59,7 +59,7 @@ board.on("ready", function() {
## Learn More
-- [I2C Backback Firmare](https://github.com/rwaldron/johnny-five/blob/master/firmwares/dht11_i2c_nano_backpack.ino)
+- [I2C Backback Firmare](https://github.com/rwaldron/johnny-five/blob/master/firmwares/dht_i2c_nano_backpack.ino)
&nbsp;
@@ -0,0 +1,74 @@
+<!--remove-start-->
+
+# Thermometer - DHT22_I2C_NANO_BACKPACK
+
+<!--remove-end-->
+
+
+
+
+
+
+##### Thermometer DHT22
+
+
+
+![docs/breadboard/multi-DHT22_I2C_NANO_BACKPACK.png](breadboard/multi-DHT22_I2C_NANO_BACKPACK.png)<br>
+
+Fritzing diagram: [docs/breadboard/multi-DHT22_I2C_NANO_BACKPACK.fzz](breadboard/multi-DHT22_I2C_NANO_BACKPACK.fzz)
+
+&nbsp;
+
+
+
+
+Run this example from the command line with:
+```bash
+node eg/temperature-DHT22_I2C_NANO_BACKPACK.js
+```
+
+
+```javascript
+var five = require("../");
+var board = new five.Board();
+
+board.on("ready", function() {
+ var thermometer = new five.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("--------------------------------------");
+ });
+});
+
+
+```
+
+
+
+
+
+
+
+
+
+## Learn More
+
+- [I2C Backback Firmare](https://github.com/rwaldron/johnny-five/blob/master/firmwares/dht_i2c_nano_backpack.ino)
+
+&nbsp;
+
+<!--remove-start-->
+
+## License
+Copyright (c) 2012, 2013, 2014 Rick Waldron <waldron.rick@gmail.com>
+Licensed under the MIT license.
+Copyright (c) 2016 The Johnny-Five Contributors
+Licensed under the MIT license.
+
+<!--remove-end-->
@@ -0,0 +1,15 @@
+var five = require("../");
+var board = new five.Board();
+
+board.on("ready", function() {
+ var hygrometer = new five.Hygrometer({
+ controller: "DHT22_I2C_NANO_BACKPACK"
+ });
+
+ hygrometer.on("change", function() {
+ console.log("Hygrometer");
+ console.log(" relative humidity : ", this.relativeHumidity);
+ console.log("--------------------------------------");
+ });
+});
+
@@ -0,0 +1,21 @@
+var five = require("../");
+var board = new five.Board();
+
+board.on("ready", function() {
+ var multi = new five.Multi({
+ controller: "DHT22_I2C_NANO_BACKPACK",
+ pin: 2,
+ });
+
+ multi.on("change", function() {
+ console.log("Thermometer");
+ console.log(" celsius : ", this.thermometer.celsius);
+ console.log(" fahrenheit : ", this.thermometer.fahrenheit);
+ console.log(" kelvin : ", this.thermometer.kelvin);
+ console.log("--------------------------------------");
+
+ console.log("Hygrometer");
+ console.log(" relative humidity : ", this.hygrometer.relativeHumidity);
+ console.log("--------------------------------------");
+ });
+});
@@ -0,0 +1,17 @@
+var five = require("../");
+var board = new five.Board();
+
+board.on("ready", function() {
+ var thermometer = new five.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("--------------------------------------");
+ });
+});
+
Oops, something went wrong.

0 comments on commit d75ac0c

Please sign in to comment.