DHT sensor ERROR compiling for board arduino uno

its telling me that error compiling for board arduino uno
and i have the DHT libary installed

#include <DHT.h>



#define dht_apin AO


dht, DHT;


void setup()
{

 Serial.begin(9600);
 
 delay(500);

 Serial.println("DHT11 Humidity & temperature Sensor\n\n");

 delay(1000);

}

void loop()
{
  DHT.read11 (dht_apin);


  Serial.print("Current humidity = ");
  Serial.print(DHT.humidity);
  Serial.print("%  ");
  Serial.print("temperature = ");
  Serial.print(DHT.temperature);
  Serial.println("C  ");

delay(5000);
  
}```

The error you didn't post - it's right about there?

what i didnt understand

I don't know what you didn't understand.
You seem like you don't want to share stuff, like things we need to know.

like what

Like the error message you claim to have seen.

ok ill show you

Arduino: 1.8.15 (Windows 10), Board: "Arduino Uno"

In file included from D:\documents\Arduino\libraries\DHT_sensor_library-1.4.2\DHT_U.cpp:15:0:

D:\documents\Arduino\libraries\DHT_sensor_library-1.4.2\DHT_U.h:36:10: fatal error: Adafruit_Sensor.h: No such file or directory

#include <Adafruit_Sensor.h>

      ^~~~~~~~~~~~~~~~~~~

compilation terminated.

exit status 1

Error compiling for board Arduino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

here

That looks pretty clear to me.

Where did you install the library, and how?

@mos100, your topic has been moved to a more suitable location on the forum.

A number (or all) Adafruit libraries rely on other Adafruit libraries. So install the Adafruit_Sensor library and try again; if another library error shows, repeat for the library.

I would further suggest that you start with one of the examples, your code does not feel right (as @anon73444976 indicated in post #2).

Hi,
Do you have the DHT or dht library?

This works for me;

#include <dht.h>

dht DHT;

#define dht_apin A0

Note also pin A0 not AO.

Tom... :smiley: :+1: :coffee: :australia:
PS, Did you have a really good look at the examples in the IDE for the dht?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.