Hi i took the advise of some people from here and started my code again
This is an egg hatcher machine
Its still very early in development that's why its missing most of its void loop(). I started writing the loop() and i began with the most obvious component the dht22 sensor.
My question is why is my LCD screen showing the temperature and humidity at 0%?
At some point before that when i first tried it on the serial monitor it said (nan) on both values but i figured that it was a library / coding error.
Now i cant figure this out its not a coding problem because the code is verified through the ide.
Its not a wiring problem either

Here is my code below:
//Libraries
#include <Wire.h>
//This library allows you to communicate with I2C/TWI devices.
#include <LiquidCrystal_I2C.h>
//This library allows you to communicate with your LiquidCrystalDevice
#include <dht.h>
//This library allows you to communicate with your DHT22 sensor
#include <Servo.h>
//This library allows you to communicate with your servo motor
//Variables
float hum; //Stores humidity value
float temp; //Stores temperature value
//Constants
#define DHTPIN 3 //The pin 3 is used for DHT22
LiquidCrystal_I2C lcd(0x27, 16, 2); // set the LCD address to 0x27 for a 16 chars and 2 line display
#define DHTTYPE DHT22 //The type of DHT sensor we are using
dht DHT; //Initialize the DHT sensor
#define RELAYPIN 10 //The pin 10 is used for the Relay
#define SERVOMOTOR 9 //The pin 9 is used for the servo motor
void setup() {
Serial.begin(9600); //Allows us to vie our temp and hum values from the serial Monitor
lcd.begin(16, 2); // This function initiates our lcd 16 is the number of columns and 2 is the number of rows.
lcd.init(); //This function initializes the interface to the LCD
lcd.clear(); // This function clears the LCD screen and positions the cursor in the upper-left corner
lcd.backlight(); //This function turns on the LCD backlight
pinMode(RELAYPIN, OUTPUT); //Declaring the relay pin as an output
pinMode(SERVOMOTOR, OUTPUT); //Declaring the servomotor pin as an output
}
void loop() {
byte CelsiusSymbol[] = {
0b11100,
0b10100,
0b11100,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000
};
int chk = DHT.read22(DHTPIN);
//Read data and store it to variables hum and temp
hum = DHT.humidity;
temp = DHT.temperature;
//Print temp and humidity values to LCD
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(temp);
lcd.print('c');
lcd.createChar(0, CelsiusSymbol ); // create a new custom character
lcd.setCursor(11, 0); // move cursor to (11, 0)
lcd.write((byte)0); // print the custom char at (11, 0)
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(hum);
lcd.print("%");
delay(2000); //Delay 2 sec between temperature/humidity check.
}






