Simple home automation using arduino

Simple Home Automation Using Arduino





void setup()

{

Serial.begin(38400);

pinMode(8, OUTPUT);

digitalWrite(8,HIGH);

}

void loop() {

while(Serial.available()) {

delay(10);

char c=Serial.read();

if(c=='#')

{break; }

voice += c;

}

if (voice.length() > 0) {

Serial.println(voice);

if (voice == "Alexa light on" )

{

digitalWrite(2,LOW);

}



if (voice == "Alexa light off" )

{

digitalWrite(2,HIGH);

}

if (voice == "Alexa light of" )

{

digitalWrite(2,HIGH);

}

voice="";

}

}









Post a Comment

0 Comments