HELP WITH DHT11 (humidity/temperature sensor)

Posted on
  • I'm using a temperature / humidity sensor (DHT11) like this:

    var dht = require ("DHT11"). connect (C11);
    dht.read (function (a) {console.log ("Temp is" + a.temp.toString () + "and RH is" + a.rh.toString ());});

    However, I wanted a resolution of at least two decimal places. But I only get the whole number ... How should I proceed?

  • add toFixed(2)

    a.temp.toFixed(2).toString()
    a.rh.toFixed(2).toString()

  • @MaBe thanks for the support.

    But, i want to know if the sensor has more resolution. With toFixed(2) appears .00 and i need por precision to study my data. The question is: DHT11 has this resolution? There are some code that i have to add? Thanks

  • Not sure what you expect from a cheap sensor like

    DHT11t +-2 degrees accuracy

    DHT22 +-0.5 degrees accuracy

    and than it’s getting expensive like

    TMP117 +- 0.1 degrees accuracy

  • Thank you! I'll provide a DHT22

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

HELP WITH DHT11 (humidity/temperature sensor)

Posted by Avatar for cogo33 @cogo33

Actions