This is the code for a temperature and humidity sensor, and I have the Arduino main DHT master library, but it is not being used, even when I include that library.
#include <DHT.h>
/* DHT11/ DHT22 Sensor Temperature and Humidity Tutorial
* Program made by Dejan Nedelkovski,
* www.HowToMechatronics.com
*/
/*
* You can find the DHT Library from Arduino official website
* https://playground.arduino.cc/Main/DHTLib
*/
#include <LiquidCrystal.h> // includes the LiquidCrystal Library
#include <dht.h>
#define dataPin 2
LiquidCrystal lcd(1, 2, 4, 5, 6, 7); // Creates an LCD object. Parameters: (rs, enable, d4, d5, d6, d7)
dht DHT;
void setup() {
lcd.begin(16,2); // Initializes the interface to the LCD screen, and specifies the dimensions (width and height) of the display
}
void loop() {
int readData = DHT.read22(dataPin);
float t = DHT.temperature;
float h = DHT.humidity;
lcd.setCursor(0,0); // Sets the location at which subsequent text written to the LCD will be displayed
lcd.print("Temp.: "); // Prints string "Temp." on the LCD
lcd.print(t); // Prints the temperature value from the sensor
lcd.print(" C");
lcd.setCursor(0,1);
lcd.print("Humi.: ");
lcd.print(h);
lcd.print(" %");
delay(2000);
}
Temp_Humid.ino:20: error: 'dht' does not name a type
dht DHT;
^
/home/rob/Arduino/Temp_Humid.ino/Temp_Humid.ino/Temp_Humid.ino.ino: In function 'void loop()':
Temp_Humid.ino:25: error: expected primary-expression before '.' token
int readData = DHT.read22(dataPin);
^
Temp_Humid.ino:26: error: expected primary-expression before '.' token
float t = DHT.temperature;
^
Temp_Humid.ino:27: error: expected primary-expression before '.' token
float h = DHT.humidity;
^
Multiple libraries were found for "DHT.h"
Used: /home/rob/Arduino/libraries/DHT
Not used: /home/rob/Arduino/libraries/arduino-DHT-master
Not used: /home/rob/Arduino/libraries/DHT_sensor_library
Not used: /home/rob/Downloads/arduino-1.8.5/libraries/arduino-DHT-master
Not used: /home/rob/Downloads/arduino-1.8.5/libraries/DHT-sensor-library-master
Multiple libraries were found for "LiquidCrystal.h"
Used: /home/rob/Arduino/libraries/LiquidCrystal
Not used: /home/rob/Arduino/libraries/Newliquidcrystal_1.3.5
Not used: /home/rob/Downloads/arduino-1.8.5/libraries/Newliquidcrystal_1.3.5
Not used: /home/rob/Downloads/arduino-1.8.5/libraries/LiquidCrystal
Using library DHT in folder: /home/rob/Arduino/libraries/DHT (legacy)
Using library LiquidCrystal in folder: /home/rob/Arduino/libraries/LiquidCrystal (legacy)
exit status 1
'dht' does not name a type