Jugaadu decides to develop an advanced Automation system for his home. As he is always in a hurry, in the morning while he leaves for his office. Therefore, he wants to operate almost all the devices in his home( like turning ON and OFF- lights, water pump and others with an automation system). How can you help him? ants even remotely?
String inputString;
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
}
void loop() {
while(Serial.available()){
delay(50);
char c=Serial.read();
inputString+=c;
}
if(inputString.length()>0){
Serial.println(inputString);
if (inputString =="LEDON"){
digitalWrite(13, HIGH);
}
else if (inputString =="LEDOFF"){
digitalWrite(13, LOW);
}
else if (inputString =="BUZZON"){
digitalWrite(8, HIGH);
}
else if (inputString =="BUZZOFF"){
digitalWrite(8,LOW);
}
else if (inputString =="PUMPON"){
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
}
else if (inputString =="PUMPOFF"){
digitalWrite(6,LOW);
digitalWrite(7,LOW);
}
inputString="";
}
delay(100);
}