#include <LiquidCrystal.h>
#include <DHT.h>
#define LCDCONTRASTPIN 6
#define DHTPIN 13
#define LIGHTPIN40W 8
#define LIGHTPIN60W 7
//#define FANPIN 9
#define LCDCONTRASTLEVEL 70
DHT dht(DHTPIN, DHT22);
float hum;
float temp;
float humhigh;
int pos = 0;
int sec = 0;
int Min = 0;
int day = 0;
int hrs = 0;
bool humidityflag = true;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
//Serial.begin(9600);
// pinMode(FANPIN, OUTPUT);
pinMode(LIGHTPIN40W, OUTPUT);
pinMode(LIGHTPIN60W, OUTPUT);
analogWrite(LCDCONTRASTPIN,LCDCONTRASTLEVEL);
lcd.begin(16, 2);
dht.begin();
lcd.setCursor(0, 0);
lcd.print(" Welcome !!!");
lcd.setCursor(0, 1);
lcd.print(“MRM-Brintha Cons”);
delay(5000);
lcd.clear();
}
void loop()
{
if (humidityflag == true)
{
hum = dht.readHumidity();
temp= dht.readTemperature();
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“H:”);
lcd.print(String(hum)+"%");
lcd.setCursor(8,0);
lcd.print(“F:”);
lcd.println(String((temp9/5)+32)+" “);
//lcd.println(String(temp)+“C”);
lcd.setCursor(0,1);
lcd.print(“M:” + String(Min));
lcd.setCursor(6,1);
lcd.print(“H:” + String(hrs));
lcd.setCursor(11,1);
lcd.print(“D:” + String(day)+” ");
if (((temp9/5)+32) <= 100)
{
digitalWrite(LIGHTPIN60W,HIGH);
digitalWrite(LIGHTPIN40W,HIGH);
}
if (((temp9/5)+32) > 100 && ((temp9/5)+32) < 102)
{
digitalWrite(LIGHTPIN60W,LOW);
//digitalWrite(LIGHTPIN40W,HIGH);
}
if (((temp*9/5)+32) >= 102)
{
delay(50);
digitalWrite(LIGHTPIN40W, LOW);
}
when i excute the above code, first both lights are on, Then its getting switched off both bulbs.
If i run single code as below
if (((temp*9/5)+32) <= 100)
{
digitalWrite(LIGHTPIN60W,HIGH);
// digitalWrite(LIGHTPIN40W,HIGH);
}
a single bulb is on …