Problem compiling sketch for DHT22

Hi I am new to arduino and I am just setting up a DHT22 sensor to monitor humidity and temperature. I copied a simple code for just plugging the DHT22 into the uno board with no lcd or anything. I copied i into the arduino program and pressed verify/compile and it would not work and gave me an error message
Arduino: 1.8.5 (Windows 10), Board: “Arduino/Genuino Uno”

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\aherr\Documents\Arduino\libraries\libraries -fqbn=arduino:avr:uno -ide-version=10805 -build-path C:\Users\aherr\AppData\Local\Temp\arduino_build_717052 -warnings=none -build-cache C:\Users\aherr\AppData\Local\Temp\arduino_cache_721426 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\aherr\Documents\Arduino\libraries\sketch_sep29c\sketch_sep29c.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\aherr\Documents\Arduino\libraries\libraries -fqbn=arduino:avr:uno -ide-version=10805 -build-path C:\Users\aherr\AppData\Local\Temp\arduino_build_717052 -warnings=none -build-cache C:\Users\aherr\AppData\Local\Temp\arduino_cache_721426 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\aherr\Documents\Arduino\libraries\sketch_sep29c\sketch_sep29c.ino
Using board ‘uno’ from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core ‘arduino’ from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Build options changed, rebuilding all
Detecting libraries used…
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “C:\Users\aherr\AppData\Local\Temp\arduino_build_717052\sketch\sketch_sep29c.ino.cpp” -o “nul”
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “C:\Users\aherr\AppData\Local\Temp\arduino_build_717052\sketch\sketch_sep29c.ino.cpp” -o “C:\Users\aherr\AppData\Local\Temp\arduino_build_717052\preproc\ctags_target_for_gcc_minus_e.cpp”
C:\Users\aherr\Documents\Arduino\libraries\sketch_sep29c\sketch_sep29c.ino:6:18: fatal error: DHT.h: No such file or directory

#include <DHT.h>;

^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

fatal error: DHT.h: No such file or directory

Error messages really don't get any clearer than that. Have you downloaded and installed this library? Where do you have it located on your computer.

yes I have the library installed and its in the Arduino>libraries folder

Are you certain the library you installed contains a file named exactly DHT.h, and not dht.h?

Am I supposed to change the file name??

aherrmann10:
Am I supposed to change the file name??

Either that or change the include. They gotta match. If the file has a different name from what’s used in the #include line then it should be pretty obvious that it isn’t going to find the right file.

You should use the library that the code was written for. If the filename is wrong, that almost certainly means you have the wrong library installed.

Delta_G:
Either that or change the include. They gotta match. If the file has a different name from what's used in the #include line then it should be pretty obvious that it isn't going to find the right file.

Hey man, while I respect that you are trying to help, your comments come off like a whiny ass kid. If you didnt see the "newbie" next to my name, and the part where i introduced myself as a new user, then here I am reminding you. Those smart-ass comments are childish and clearly not helpful. Please do not comment any further remarks on my post. Thank you.

What was smart ass about that? You appeared to be having trouble understanding why your file wasn't being found. Whatever dude. Good luck. Hope you figure it out. I'll never try to help you again if you're going to be a dick whenever you don't like what you read.

Delta_G:
What was smart ass about that? You appeared to be having trouble understanding why your file wasn't being found. Whatever dude. Good luck. Hope you figure it out. I'll never try to help you again if you're going to be a dick whenever you don't like what you read.

You keep suggesting these things should be obvious. No, not to a new user. Im just asking for help, not for you to tell me that the solution to my problem is obvious. If it was obvious to me, then I wouldn't be asking this question. Use your noodle.

No, even a new user should be able to know that you have to have to use the files actual name to refer to it. I think that should be obvious even to the newbie.

I mean how would you propose that could even work, that you could just write anything and somehow the computer would guess which file you want to open without you using its actual name?

Delta_G:
No, even a new user should be able to know that you have to have to use the files actual name to refer to it. I think that should be obvious even to the newbie.

I mean how would you propose that could even work, that you could just write anything and somehow the computer would guess which file you want to open without you using its actual name?

dude go away.

Hoping someone can actually help me. The link to the project is here.

this is what he says to download.

I downloaded that and put it into my library folder.

I renamed the folder DHT per the instructions on the download site

I included this library in my sketch.

I clicked verify/compile.

This is my error message:

Arduino: 1.8.5 (Windows 10), Board: “Arduino/Genuino Uno”

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\aherr\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10805 -build-path C:\Users\aherr\AppData\Local\Temp\arduino_build_549653 -warnings=none -build-cache C:\Users\aherr\AppData\Local\Temp\arduino_cache_238764 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\aherr\Documents\Arduino\sketch_sep29a\sketch_sep29a.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\aherr\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10805 -build-path C:\Users\aherr\AppData\Local\Temp\arduino_build_549653 -warnings=none -build-cache C:\Users\aherr\AppData\Local\Temp\arduino_cache_238764 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\aherr\Documents\Arduino\sketch_sep29a\sketch_sep29a.ino
Using board ‘uno’ from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core ‘arduino’ from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used…
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “C:\Users\aherr\AppData\Local\Temp\arduino_build_549653\sketch\sketch_sep29a.ino.cpp” -o “nul”
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Users\aherr\Documents\Arduino\libraries\DHT” “C:\Users\aherr\AppData\Local\Temp\arduino_build_549653\sketch\sketch_sep29a.ino.cpp” -o “nul”
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “-IC:\Users\aherr\Documents\Arduino\libraries\DHT” “C:\Users\aherr\AppData\Local\Temp\arduino_build_549653\sketch\sketch_sep29a.ino.cpp” -o “C:\Users\aherr\AppData\Local\Temp\arduino_build_549653\preproc\ctags_target_for_gcc_minus_e.cpp”
In file included from C:\Users\aherr\Documents\Arduino\sketch_sep29a\sketch_sep29a.ino:2:0:

C:\Users\aherr\Documents\Arduino\libraries\DHT/DHT_U.h:25:29: fatal error: Adafruit_Sensor.h: No such file or directory

#include <Adafruit_Sensor.h>

^

compilation terminated.

Using library DHT at version 1.3.0 in folder: C:\Users\aherr\Documents\Arduino\libraries\DHT
exit status 1
Error compiling for board Arduino/Genuino Uno.

You should first try the example programs that come with the library you downloaded. If they don't work, there's something wrong with your installation that needs fixing before you even try to work with custom code.

Hey aherrmann10

It looks like Adafruit have change the way they do things now
Anyway… download the library from

and overwrite the one you downloaded before.
The library will contain DHT.h and DHT_U.h
The file DHT_U.h (which is what is causing your problems) is a new unified driver. The example sketch is doing things the old way.

Once you have downloaded and overwritten, make sure that the line “#include <DHT.h>;” is under “//Libraries”
If you have the line “#include <DHT_U.h>;”, remove it.

The top section of the sketch (.ino file) should look like this:

/* How to use the DHT-22 sensor with Arduino uno
   Temperature and humidity sensor
   More info: http://www.ardumotive.com/how-to-use-dht-22-sensor-en.html
   Dev: Michalis Vasilakis // Date: 1/7/2015 // www.ardumotive.com */

//Libraries
#include <DHT.h>;

//Constants
#define DHTPIN 7     // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino

see how that goes

If you watch the video for the project, the author tells you where to get the library the code was written for:

It's a shame they didn't take a few seconds to add a comment in their code with that link. There are quite a few comments on the Project Hub page of people asking where they can get the library, which the author had to answer, so it would have actually saved them a lot of time in the end.

I have had trouble getting the DHT11 to compile and work also a newbie with no experience. After 4 attempts i got it to work although i really dont understand parts of the code i found and even a simple change such as serial.print to serial.println will make it fail to compile. Check out my post and although its gotten complicated from someone merging to different posts and two different problems youll be able to find my code that works and try it. In the IDE libaries there are 3 dht sensor files you might have to add all 3 and try including different files till your code works. The post is DHT error .

Ripcrow:
even a simple change such as serial.print to serial.println will make it fail to compile.

This is why you need to take the time to actually understand what you're doing instead of randomly copy/pasting in hopes you might end up with something that works purely by chance.

Ripcrow:
Check out my post and although its gotten complicated from someone merging to different posts and two different problems youll be able to find my code that works and try it.

Instead of reading a long, worthless thread you could just look at the examples that come with the library instead.