Please check my module

var express = require(‘express’);
var app = express();
var path = require(‘path’);
var bodyParser = require(‘body parser’);
var Gpio = require(‘onoff’).Gpio;

extended: true

const dht = require(‘node-dht-sensor’);

if(!dht.initialize(11, 4)){
console.log(‘Failed to initialize sensor’);

var led1 = new Gpio(17, ‘out’);
var led2 = new Gpio(18, ‘out’);
var led3 = new Gpio(27, ‘out’);

setInterval(function() {
const readout =;
if(readout.temperature.toFixed(1) > 35){

else if(readout.temperature.toFixed(1) > 36){

else if(readout.temperature.toFiexd(1) > 37){
}, 2000);

35℃ turn on a 1 led
36℃ turn on a 2 led
37℃ turn on a 3 led

it doesn’t work.

how to fix?

thanks you.

Could you not place the sensor directly on the breadboard? You may need one more wire to the sensors too. Can’t comment on the programming.

just connect it like this?

thank you.

From looking at the pin description on the temp/humidity sensor it appears you need a 1K pull up resistor to VCC from the data signal so your second wire needs to go to the breadboard with a 1K resistor to VCC and a wire to the RPI data pin. As well it would be easier to comment on this if you posted the .fzz file of the sketch that created the above images as we could then see what I/O pins you are using on the PI.