Hi,
I was trying to make a set-up to control and measure the temperature and humidity in an incubator using an Arduino Uno, a JHD 16x2 LCD, 22k potentiometer, a 5V relay, a bulb and a DHT11 sensor.
On uploading the code (given below) the values of temperature and humidity are shown on the LCD, but if I try adjusting the pot the characters change.
CODE:
#include <dht.h> // Library for DHT11 Sensor
#include <LiquidCrystal.h> // Library for LCD
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
dht DHT;
const int pinLight = 6;
#define DHT11_PIN 7 // Assigned Pin for DHT11 Sensor
/* The setup() function is called when a sketch starts. It is used to initialize variables, pin modes, start using libraries, etc. This function will only run once, after each power up or reset of the Arduino board. */
void setup()
{
lcd.begin(16, 2);
}
/* The loop() function executes the program repeatedly until Specified. */
void loop()
{
int chk = DHT.read11(DHT11_PIN); // Read the values of DHT11 from assigned Pin
lcd.setCursor(0,0); // Set cursor values
lcd.print("Temp: "); // Print the message
lcd.print(DHT.temperature); // Print the values
lcd.print((char)223); // Print the degree symbol on LCD
lcd.print("C"); // Print the Message
lcd.setCursor(0,1); // Set cursor values
lcd.print("Humidity: "); // Print the Message
lcd.print(DHT.humidity); // Print the values
lcd.print("%"); // Print the Message
{
if(DHT.temperature < 37)
digitalWrite(pinLight, HIGH);
else if(DHT.temperature > 37.5)
digitalWrite(pinLight, LOW);
}
delay(1000); // Hold By 1000 ms
}