2 Part. DHT11 compile error in particular, Libraries in general

This is my first attempt at doing something other than a 'Starter book' example.
Instead of a simple TMP36 sensor, I bought the DHT11 on Amazon.
But (big step for me!) it uses
#include <DHT.h>,
and it also threw in
#include <DHT_U.h>
and i added (to instantiate)
DHT myDht ;
Fine.
But attempting to compile, I get an error on
DHT myDht ;
of: no matching function call to 'HDT::DHT()'
NO idea where to turn :frowning:

Also, in general, how/where do you find the commands (or properties) that go with any given (class) library?
Other than what I stumbled on in the example, in general how does anyone know that DHT should respond to
.read
.temperature
.humidity
. (anything else???)

thanks!!!!

Henry

Take a look at the examples that came with the library

Almost certainly you declare an instance of the DHT object like this
DHT dht(DHTPIN, DHTTYPE);where the 2 variables are the relevant values, ie the pin and sensor type

Sadly, one error after another.
YES, I DID declare an instance of the class as follows (which heled, but then MORE errors:)

THEN discovered that the commands in the sample Sketch DON'T EXIST
eg, myDHT.temperature gets a compile error saying 'do you mean .readTemperature
but then I needed to make it
Serial.print (myDHT.readTemperature() ) ) ; // as there are also some passed params to .readTemperature.
ditto for
Serial.print (myDHT.readtHumidity() ) ;

Here's the code, that compiled and ran, but the output was garbage:

#include <DHT.h>
#include <DHT_U.h>
#define DHT11_PIN 3
#define DHTTYPE DHT11
DHT myDHT(DHT11_PIN, DHTTYPE) ;

//if you need to change the pin number, Edit the pin with arduino pin.
void setup()
{
Serial.begin(9600);
Serial.println("The real time Temperature and Humidity is :");
}
void loop() { // READ DATA
int chk = myDHT.read(DHT11_PIN);
Serial.print(" Temparature ");
Serial.print(myDHT.readTemperature());
Serial.println('C');
Serial.print(" Humidity: " );
Serial.print(myDHT.readHumidity());
Serial.println('%');
delay(2000);
}
//=====================================
The real time Temperature and Humidity is :
Temparature -13.00C
Humidity: 144.00%
Temparature nanC
Humidity: nan%
Temparature nanC
Humidity: nan%
Temparature nanC
Humidity: nan%
Temparature nanC
Humidity: nan%

THEN discovered that the commands in the sample Sketch DON'T EXIST

There is more than one DHT library available and each may have a different set of functions and/or syntax to use them

If you turn on verbose output for compilation in Preferences you can see which library is being used