Can't add Library dht.zip

Hello,

I am new to Arduino IDE programming, I use the arduino sensor kit tutorial from the "Most complete starter kit - UNO R3 Project" and I work under Fedora 28.

In Lesson 4 of the tutorial I try to use an example program to measure temperature and humidity with a sensor. It says that I should include the Library dht.zip as in an earlier lesson.

The first thing I've tried was to include the library as following:
Sketch > Include Library > Add .zip Library...
But I got the following error:

Specified folder/zip file does not contain a valid library

The second thing I tried was to use the Library finder from the IDE where I installed the dht sensor libraries:
Sketch > Include Library > Manage Libraries...

/home/user/Documents/arduino/Elegoo/Elegoo 37 Sensor Kit Tutorial for UNO R3 and Mega 2560 V2.0.0.2018.10.25/code/Lesson 4 TEMP AND HUMIDITY MODULE/DHT_nonblocking/DHT_nonblocking.ino:2:10: fatal error: dht_nonblocking.h: No such file or directory
#include <dht_nonblocking.h>
** ^~~~~~~~~~~~~~~~~~~**
compilation terminated.
exit status 1
Error compiling for board Arduino/Genuino Uno.

I hope someone can help me with my problem, thank you.

Please provide a link to where you downloaded this dht.zip from. Use the chain links icon on the toolbar to make the link clickable.

Himring:
The second thing I tried was to use the Library finder from the IDE where I installed the dht sensor libraries:
Sketch > Include Library > Manage Libraries...

The trouble with that is there are multiple DHT libraries and you need the one your sketch was written for. So you're better to follow whatever documentation comes with the sketch instead of hoping that some random pick of library will happen to work.

Thanks pert for your fast reply:

I use this tutorial: here it contains the big pdf with step by step introductions together with code examples.

The example together with the library I am working on right now is in this folder:
Elegoo 37 Sensor Kit Tutorial for UNO R3 and Mega 2560 V2.0.0.2018.10.25/code/Lesson 4 TEMP AND HUMIDITY MODULE/

The problem is that the dummies at Elegoo added an extra folder level in the file DHT.zip. For the "Add .zip Library..." installation technique, the library should be in the root of the .zip file, not a subfolder.

The solution is to:

  • Unzip the file DHT.zip. This will result in a folder named DHT that contains another folder named DHT, which contains the library.
  • (In the Arduino IDE) Sketch > Include Library > Add .zip library...
  • Select the DHT subfolder of the unzipped folder.
  • Click "Open".

It's not obvious, but "Add .zip Library..." allows you to install libraries from folders as well as from .zip files.

Thanks pert!

I had to zip the subfolder again. After that adding the library with:
(In the Arduino IDE) Sketch > Include Library > Add .zip library...
and compiling worked like a charm! :smiley:

It's not necessary to zip the folder since Add .zip library... can accept folders as well as .zip files. Regardless, I'm glad to hear you got the library to install. Enjoy!
Per