@Gordon this does not work for me. I'm using AM2302, ESP8266
>reset()
=undefined
_____ _
| __|___ ___ ___ _ _|_|___ ___
| __|_ -| . | _| | | | | . |
|_____|___| _|_| |___|_|_|_|___|
|_| http://espruino.com
1v85 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
>
{
"raw": "0100000001100110110000000100110000110011011",
"rh": 41.1, "temp": -30.4 }
Temp is -30.4 and RH is 41.1
{ "err": true, "checksumError": false,
"raw": "",
"temp": -1, "rh": -1 }
It is getting err: true, if I unplug/replug the data pin from the AM2302 then sometimes it reads like this negative value.
This is the code what i'm using now:
var pin=D2;
var dht = require("https://raw.githubusercontent.com/espruino/EspruinoDocs/master/devices/DHT22.js").connect(pin);
setInterval(function() {
dht.read(
function(a){
console.log(a);
console.log("Temp is "+a.temp.toString()+
" and RH is "+a.rh.toString());
});}, 1000);
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@Gordon this does not work for me. I'm using AM2302, ESP8266
It is getting err: true, if I unplug/replug the data pin from the AM2302 then sometimes it reads like this negative value.
This is the code what i'm using now:
Using this is wrong to: