void setup() {
Serial.begin(9600);
pinMode(A0,INPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
void loop() {
int val=analogRead(A0);
Serial.println(val);
if(val<350){
digitalWrite(12, LOW);
digitalWrite(13, HIGH);
delay(500);
}
if(val>1000)
{
digitalWrite(12,HIGH);
digitalWrite(13,LOW);
}
}
Smart irrigation
Home automation
Comments