Dht sensor control using node.js and pigpio. Supported sensors are DHT11, DHT22 and AM2302.
- Install pigpio C library.
- Install module:
npm i pigpio-dht.
const dht = ;const sensor = ;
|DHT22 or AM2302||22|
const dht = ;const dataPin = 5;const dhtType = 22; //optionalconst sensor = ;; // the sensor can only be red every 2 secondssensor;sensor;
Start a new reading of the sensor. This can't be called more then once every second for the DHT11 sensor or once every 2 seconds for the DHT22 sensor.
Emitted when starting to read a value.
Emitted when the reading stops. This because it was complete, an error occurred or anything else.
- result object containing temperature and humidity
Emitted when the reading was completed successful.
Emitted when finished reading but the checksum was invalid.
- pigpio - Gpio wrapper for nodejs