title: DHT11 sensor with wrong values, wanting to add values to the reading that comes from sensor
body: <p>I need assistance, I'm new to Arduino and I'm running a DHT11 sensor on NodeMCU 1.0 board, I find on many trends that this sensor is inaccurate mostly on the humidity readings, which brings me to my question, I want to add/subtract a percentage from the reading that comes from the sensor that displays on the HTML page. Could anyone assist, please?</p>
  
  <p>PS I attached the code im using.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>include &lt;ESP8266WiFi.h&gt;
  #include &lt;WiFiClient.h&gt;
  #include &lt;ESP8266WebServer.h&gt;
  #include &lt;ESP8266mDNS.h&gt;
  #include "DHT.h"
  
  // Uncomment one of the lines below for whatever DHT sensor type you're using!
  #define DHTTYPE DHT11   // DHT 11
  //#define DHTTYPE DHT21   // DHT 21 (AM2301)
  //#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321
  
  MDNSResponder mdns;
  
  // Replace with your network details
  const char* ssid = "Temperature_Server";
  const char* password = "vishaworld.com";
  
  ESP8266WebServer server(80);
  
  String webPage = "";
  
  // DHT Sensor
  const int DHTPin = 4;
  DHT dht(DHTPin, DHTTYPE);
  static char celsiusTemp[7];
  static char fahrenheitTemp[7];
  static char humidityTemp[7];
  float h, t, f;
  
  void setup(void) {
    IPAddress Ip(10, 10, 10, 10);
    IPAddress NMask(255, 255, 255, 0);
    WiFi.mode(WIFI_AP);
    WiFi.softAPConfig(Ip, Ip, NMask);
    WiFi.softAP(ssid, password);
  
    delay(1000);
    Serial.begin(9600);
    Serial.println("");
  
    // Wait for connection
    delay(5000);
    Serial.println("");
    Serial.print("SoftAP IP address: ");
    Serial.println(WiFi.localIP());
  
    dht.begin();
  
    if (mdns.begin("esp8266", WiFi.localIP())) {
      Serial.println("MDNS responder started");
    }
  
    server.on("/", []() {
      webPage = "";
      webPage += "&lt;!DOCTYPE HTML&gt;";
      webPage += "&lt;html&gt;";
      webPage += "&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Temperature and Humidity&lt;/h1&gt;&lt;h3&gt;Temperature in Celsius: ";
      webPage += "&lt;meta http-equiv=\"refresh\" content=\"6\"&gt;" ;
      webPage += celsiusTemp;
      webPage += "*C&lt;/h3&gt;&lt;h3&gt;Temperature in Fahrenheit: ";
      webPage += fahrenheitTemp;
      webPage += "*F&lt;/h3&gt;&lt;h3&gt;Humidity: ";
      webPage += humidityTemp;
      webPage += "%&lt;/h3&gt;&lt;h3&gt;";
      webPage += "&lt;/body&gt;&lt;/html&gt;";
      server.send(200, "text/html", webPage);
    });
  
    server.begin();
    Serial.println("HTTP server started");
  
  }
  
  void loop(void) {
    server.handleClient();
    // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
    float h = dht.readHumidity();
    // Read temperature as Celsius (the default)
    float t = dht.readTemperature();
    // Read temperature as Fahrenheit (isFahrenheit = true)
    float f = dht.readTemperature(true);
    // Check if any reads failed and exit early (to try again).
    if (isnan(h) || isnan(t) || isnan(f)) {
      Serial.println("Failed to read from DHT sensor!");
      strcpy(celsiusTemp, "Failed");
      strcpy(fahrenheitTemp, "Failed");
      strcpy(humidityTemp, "Failed");
    }
    else {
      // Computes temperature values in Celsius + Fahrenheit and Humidity
      float hic = dht.computeHeatIndex(t, h, false);
      dtostrf(hic, 6, 2, celsiusTemp);
      float hif = dht.computeHeatIndex(f, h);
      dtostrf(hif, 6, 2, fahrenheitTemp);
      dtostrf(h, 6, 2, humidityTemp);
    }
    delay(2000);
  }
  </code></pre>