'Dht11' does not name a type

Good day all,

I have perused this forum vastly and I compliment all contributors for their knowledge and support that they afford each other.

I am a "noobie" to your forum and to Arduino and C - I do have 25 years ASM, electronics design and some Java experience..

I am trying to get some accuracy out of the inaccurate humidity sensor DHT11 and am presently following Andy Dalton's "different" idea of cycling power before measurements.

However, I have some silly problem with the Dht11.h library construct:

#include <Dht11.h> //Rob Tillaart (modified by Andy Dalton v0.2)
Dht11 DHT11; Compiler says "'Dht11' does not name a type"

I copied the Dht11.h code and installed it into MyDocuments/.../Arduino/Libraries/Dht11/Dht11.h
My Arduino IDE v1.8.3 library manager says "Dht11.h version unknown INSTALLED"

By browsing through the forum on this topic, I realize that similar problems have been solved by the library installation. Due to the fact that the library manager recognizes the library, I am at a loss.

Hopefully someone has a solution.

Maybe read this?

post your code or at least the part where you show the set up of the dht11 sensor.

Dht11 DHT11;

most dhts require something like

DHT sensor1(DHT1, DHTTYPE);

which is

DHT name you called it (pin number, type);

Hi Evanmars,

Thank you for the response. I have read https://www.arduino.cc/en/Guide/Libraries.

I cannot find the Andy version of Dht11.h in a zipped form so I pasted the code into notepad and gave it a suffix of .h I placed that in /MyDownloads/arduino/libraries/Dht11 folder. I then used the library manager to locate and include Dht11.h which it appears to have done because it acknowledges by saying "INSTALLED".
In hindsight, I do not believe this was successful.

It is likely that my method of including a library file is wrong. The suggested documentation doesn't cover my method.

I am using ravmike code DHT11 and humidty, whats the extent of the problem? - Sensors - Arduino Forum to test the DHT11 humidity sensor.

#include "DHT.h"

#define DHTPIN 2 // what digital pin we're connected to

#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);

void setup() {
Serial.begin(9600);
dht.begin();

this may help

i use this

Dht11 DHT11; Compiler says "'Dht11' does not name a type"

Note that class names are case sensitive...

try

dht11 DHT11;

Hi Rob,

Thank you for the response. I have tried Dht11 DHT11; before with no luck (I am case sensitive).

Please note that revmike does not even include the instance (Dht11 DHT11). I added this in desperation.

I do notice that if I type DHT, the IDE sketch highlights it in red and if add 11 (Dht11) then it's back to black. Seems to me that Dht11 (Andy version) is not recognized(?)

My Library manager itemises Adafruits DHT11 before Dht11 (Andy's version). Maybe the IDE is selecting Adafruit DHT11 by default - before Andy's Dht11(?)

Other than that, the manufacturers claim 5%RH resolution and I tend to believe them. My 5 samples show variances of more than 40% and I do not believe these are original items - more likely rejects from Fong Kong knock-offs - sold cheaply on the internet!

All the above is irrelevant, I'm going to throw this in and chalk it up as it is a waste of time.
Maybe I will order an A grade sample from the original manufacturers and retry!

Thank you for your time.

try the dht22 its a better sensor

use a 10k pull up resistor on the sense pin and add a cap if the sensor is unstable due to a voltage drain on the arduino. (sensor glitches when a relay fires, etc)