#define output1 2
#define output2 3
#define output3 4
#define output4 5
#define led 13
#define pump 1
//LCD PINS
#define D4 6
#define D5 7
#define D6 8
#define D7 9
#define RS 11
#define EN 12
#include <string.h>
#include <LiquidCrystal.h>
int lm35Pin = 0;
int time;
float tempreture;
LiquidCrystal lcd(12, 11, 6, 7, 8, 9);
void setup()
{
Serial.begin (9600);
lcd.begin(16, 2);
pinMode(output1, OUTPUT);
pinMode(output2, OUTPUT);
pinMode(output3, OUTPUT);
pinMode(output4, OUTPUT);
pinMode(led, OUTPUT);
pinMode(pump, OUTPUT);
}
void loop() {
tempreture = analogRead(lm35Pin);
tempreture = tempreture * 0.48828125;
lcd.setCursor(0,0);
lcd.print("TEMPRETURE:");
lcd.setCursor(12,0);
lcd.print('tempreture');
digitalWrite(output1, HIGH);
digitalWrite(output2, LOW);
digitalWrite(output3, LOW);
digitalWrite(output4, LOW);
if(tempreture>= 35)
{
digitalWrite(output2, HIGH);
digitalWrite(output1, LOW);
digitalWrite(output3, LOW);
digitalWrite(output4, LOW);
}
else if(tempreture>= 45)
{
digitalWrite(output3, HIGH);
digitalWrite(output2, LOW);
digitalWrite(output1, LOW);
digitalWrite(output4, LOW);
}
else if(tempreture>= 50)
{
digitalWrite(output4, HIGH);
digitalWrite(output2, LOW);
digitalWrite(output3, LOW);
digitalWrite(output1, LOW);
}
digitalWrite(pump, HIGH);
delay(40000);
digitalWrite(pump, LOW);
}
#define output2 3
#define output3 4
#define output4 5
#define led 13
#define pump 1
//LCD PINS
#define D4 6
#define D5 7
#define D6 8
#define D7 9
#define RS 11
#define EN 12
#include <string.h>
#include <LiquidCrystal.h>
int lm35Pin = 0;
int time;
float tempreture;
LiquidCrystal lcd(12, 11, 6, 7, 8, 9);
void setup()
{
Serial.begin (9600);
lcd.begin(16, 2);
pinMode(output1, OUTPUT);
pinMode(output2, OUTPUT);
pinMode(output3, OUTPUT);
pinMode(output4, OUTPUT);
pinMode(led, OUTPUT);
pinMode(pump, OUTPUT);
}
void loop() {
tempreture = analogRead(lm35Pin);
tempreture = tempreture * 0.48828125;
lcd.setCursor(0,0);
lcd.print("TEMPRETURE:");
lcd.setCursor(12,0);
lcd.print('tempreture');
digitalWrite(output1, HIGH);
digitalWrite(output2, LOW);
digitalWrite(output3, LOW);
digitalWrite(output4, LOW);
if(tempreture>= 35)
{
digitalWrite(output2, HIGH);
digitalWrite(output1, LOW);
digitalWrite(output3, LOW);
digitalWrite(output4, LOW);
}
else if(tempreture>= 45)
{
digitalWrite(output3, HIGH);
digitalWrite(output2, LOW);
digitalWrite(output1, LOW);
digitalWrite(output4, LOW);
}
else if(tempreture>= 50)
{
digitalWrite(output4, HIGH);
digitalWrite(output2, LOW);
digitalWrite(output3, LOW);
digitalWrite(output1, LOW);
}
digitalWrite(pump, HIGH);
delay(40000);
digitalWrite(pump, LOW);
}
No comments:
Post a Comment