Voice Control Home Automation System using Arduino || Voice control DIY

Описание к видео Voice Control Home Automation System using Arduino || Voice control DIY

Voice control home automation system using Arduino || Voice control DIY
Scroll down for code.....
Please like & Subscribe for more videos

App link
https://play.google.com/store/apps/de...

If you want to support my video please buy any product through my amazon affiliate link. I will receive a commission, at no extra cost to you.

LIST OF COMPONENT (affiliate links)

http://amzn.to/2fvSRJq (Arduino)
https://amzn.to/2JtsiPs (Bluetooth module HC-05)
http://amzn.to/2y8horo (Relay Module)
http://amzn.to/2vmSK8l (1k & 2k ohms Resistor)
http://amzn.to/2wxPmWz (Breadboard)
http://amzn.to/2vJ3lvo (Jumper wire)

char data = 0; //Variable for storing received data
void setup()
{
Serial.begin(9600); //Sets the data rate in bits per second (baud) for serial data transmission
pinMode(13, OUTPUT); //Sets digital pin 13 as output pin for Light
pinMode(12, OUTPUT); //Sets digital pin 13 as output pin for Fan
}
void loop()
{
//instead of parenthesis () put angle bracket as YouTube description does not allow angle bracket
if(Serial.available() ) 0) // Send data only when you receive data:
{
data = Serial.read(); //Read the incoming data and store it into variable data

// For Light
if(data == '1') //Checks whether value of data is equal to 1
digitalWrite(13, HIGH); //If value is 1 then Light turns ON
else if(data == '0') //Checks whether value of data is equal to 0
digitalWrite(13, LOW); //If value is 0 then Light turns OFF

// For Fan
else if(data == '2') //Checks whether value of data is equal to 2
digitalWrite(12, HIGH); //If value is 2 then Fan turns ON
else if(data == '3') //Checks whether value of data is equal to 3
digitalWrite(12, LOW); //If value is 3 then Fan turns OFF

//For ALL ON or OFF
else if(data == '4') { //Checks whether value of data is equal to 4
digitalWrite(13, HIGH); //If value is 4 then Light turns ON
digitalWrite(12, HIGH);} //If value is 4 then Fan turns ON
else if(data == '5') { //Checks whether value of data is equal to 5
digitalWrite(13, LOW); //If value is 5 then Light turns OFF
digitalWrite(12, LOW); } //If value is 5 then Fan turns OFF
}
}

Комментарии

Информация по комментариям в разработке