I know very little about Arduino code but I'm having trouble verifying it in the ide app.
here is the code and the error I'm getting
Arduino: 1.8.12 (Windows Store 1.8.33.0) (Windows 10), Board: "Arduino Uno"
C:\Users\crazy\Documents\Arduino\incubator\incubator.ino:12:0: warning: "DHT11" redefined
#define DHT11 A0
In file included from C:\Users\crazy\Documents\Arduino\incubator\incubator.ino:3:0:
C:\Users\crazy\Documents\Arduino\libraries\DHT_sensor_library/DHT.h:44:0: note: this is the location of the previous definition
#define DHT11 11 /**< DHT TYPE 11 */
incubator:37:1: error: 'dht' does not name a type
dht DHT;
^~~
incubator:38:1: error: expected unqualified-id before '{' token
{
^
C:\Users\crazy\Documents\Arduino\incubator\incubator.ino: In function 'void loop()':
incubator:127:16: error: expected primary-expression before '.' token
int chk = DHT.read11(DHT11);
^
incubator:130:10: error: 'DHTLIB_ERROR_CONNECT' was not declared in this scope
case DHTLIB_ERROR_CONNECT:
^~~~~~~~~~~~~~~~~~~~
incubator:139:18: error: expected primary-expression before '.' token
lcd.print(DHT.temperature);
^
incubator:142:18: error: expected primary-expression before '.' token
lcd.print(DHT.humidity);
^
incubator:143:12: error: expected primary-expression before '.' token
if (DHT.temperature >= T_threshold)
^
incubator:146:14: error: expected primary-expression before '.' token
if (DHT.temperature >= T_threshold)
^
incubator:151:12: error: expected primary-expression before '.' token
if (DHT.humidity >= H_threshold)
^
incubator:154:14: error: expected primary-expression before '.' token
if (DHT.humidity >= H_threshold)
^
incubator:159:12: error: expected primary-expression before '.' token
if (DHT.temperature < T_threshold)
^
incubator:162:14: error: expected primary-expression before '.' token
if (DHT.temperature < T_threshold)
^
incubator:167:12: error: expected primary-expression before '.' token
if (DHT.humidity < H_threshold)
^
incubator:170:14: error: expected primary-expression before '.' token
if (DHT.humidity < H_threshold)
^
Multiple libraries were found for "DHT.h"
Used: C:\Users\crazy\Documents\Arduino\libraries\DHT_sensor_library
Not used: C:\Users\crazy\Documents\Arduino\libraries\Grove_Temperature_And_Humidity_Sensor
exit status 1
'dht' does not name a type
the code
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#include <DHT.h>
#include <DHT_U.h>
#include <LiquidCrystal.h>
#include <Servo.h>
#include <dht.h>
#define DHT11 A0
const int ok = A1;
const int UP = A2;
const int DOWN = A3;
const int bulb = A4;
const int vap = A5;
const int rs = 12;
const int en = 11;
const int d4 = 5;
const int d5 = 4;
const int d6 = 3;
const int d7 = 2;
int ack = 0;
int pos = 0;
int sec = 0;
int Min = 0;
int hrs = 0;
int T_threshold = 25;
int H_threshold = 35;
int SET = 0;
int Direction = 0;
boolean T_condition = true;
boolean H_condition = true;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
Servo motor;
dht DHT;
{
pinMode(ok, INPUT);
pinMode(UP, INPUT);
pinMode(DOWN, INPUT);
pinMode(bulb, OUTPUT);
pinMode(vap, OUTPUT);
digitalWrite(bulb, LOW);
digitalWrite(vap, LOW);
digitalWrite(ok, HIGH);
digitalWrite(UP, HIGH);
digitalWrite(DOWN, HIGH);
motor.attach(7);
motor.write(pos);
lcd.begin(16, 2);
Serial.begin(9600);
lcd.setCursor(5, 0);
lcd.print("Digital");
lcd.setCursor(4, 1);
lcd.print("Incubator");
delay(1500);
}
void loop()
{
if (SET == 0)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Set Temperature:");
lcd.setCursor(0, 1);
lcd.print(T_threshold);
lcd.print(" *C");
while (T_condition)
{
if (digitalRead(UP) == LOW)
{
T_threshold = T_threshold + 1;
lcd.setCursor(0, 1);
lcd.print(T_threshold);
lcd.print(" *C");
delay(200);
}
if (digitalRead(DOWN) == LOW)
{
T_threshold = T_threshold - 1;
lcd.setCursor(0, 1);
lcd.print(T_threshold);
lcd.print(" *C");
delay(200);
}
if (digitalRead(ok) == LOW)
{
delay(200);
T_condition = false;
}
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Set Humidity:");
lcd.setCursor(0, 1);
lcd.print(H_threshold);
lcd.print("%");
delay(100);
while (H_condition)
{
if (digitalRead(UP) == LOW)
{
H_threshold = H_threshold + 1;
lcd.setCursor(0, 1);
lcd.print(H_threshold);
lcd.print("%");
delay(100);
}
if (digitalRead(DOWN) == LOW)
{
H_threshold = H_threshold - 1;
lcd.setCursor(0, 1);
lcd.print(H_threshold);
lcd.print("%");
delay(200);
}
if (digitalRead(ok) == LOW)
{
delay(100);
H_condition = false;
}
}
SET = 1;
}
ack = 0;
int chk = DHT.read11(DHT11);
switch (chk)
{
case DHTLIB_ERROR_CONNECT:
ack = 1;
break;
}
if (ack == 0)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Temp:");
lcd.print(DHT.temperature);
lcd.setCursor(0, 1);
lcd.print("Humidity:");
lcd.print(DHT.humidity);
if (DHT.temperature >= T_threshold)
{
delay(3000);
if (DHT.temperature >= T_threshold)
{
digitalWrite(bulb, LOW);
}
}
if (DHT.humidity >= H_threshold)
{
delay(3000);
if (DHT.humidity >= H_threshold)
{
digitalWrite(vap, LOW);
}
}
if (DHT.temperature < T_threshold)
{
delay(3000);
if (DHT.temperature < T_threshold)
{
digitalWrite(bulb, HIGH);
}
}
if (DHT.humidity < H_threshold)
{
delay(3000);
if (DHT.humidity < H_threshold)
{
digitalWrite(vap, HIGH);
}
}
sec = sec + 1;
if (sec == 60)
{
sec = 0;
Min = Min + 1;
}
if (Min == 60)
{
Min = 0;
hrs = hrs + 1;
}
if (hrs == 8 && Min == 0 && sec == 0)
{
for (pos = 0; pos <= 180; pos += 1)
{
motor.write(pos);
delay(25);
}
}
if (hrs == 16 && Min == 0 && sec == 0)
{
hrs = 0;
for (pos = 180; pos >= 0; pos -= 1)
{
motor.write(pos);
delay(25);
}
}
}
if (ack == 1)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("No Sensor data.");
lcd.setCursor(0, 1);
lcd.print("System Halted.");
digitalWrite(bulb, LOW);
digitalWrite(vap, LOW);
}
delay(1000);
}