rpi com node e node dht sensor - sidneypio/testesrpi3 GitHub Wiki
Instalando o node
curl -sL https://deb.nodesource.com/setup_12.x | bash -
apt install -y nodejs
npm --version
6.14.6
node --version
v12.18.2
Instalando node-dht-sensor
npm install node-dht-sensor
Testando
mkdir rpi-dht11
cd rpi-dht11/
npm init
root@DietPi:~/rpi-dht11# cat teste1.js
var sensor = require("node-dht-sensor");
sensor.read(11, 18, function(err, temperature, humidity) {
if (!err) {
console.log(`temp: ${temperature}°C, humidity: ${humidity}%`);
}
});
root@DietPi:~/rpi-dht11# node teste1.js
temp: 24°C, humidity: 62%