How to Control LED Using Your Voice Command Arduino | Voice Control Arduino | Fair Electro

preview_player
Показать описание
How to control different color LEDs with voice?
In this video, i show you how to control four different color LEDs with voice Command. I am using Arduino UNO R3, Bluetooth module HC-05 and four different color LEDs. Which color I speak, that LED automatically turn ON.

I am using:-

For Arduino Learning:-

Code:
String voice;

#define ledRed 4

#define ledGreen 5
#define ledBlue 6
#define ledWhite 7
void setup()
{
pinMode(ledRed, OUTPUT);
pinMode(ledGreen, OUTPUT);
pinMode(ledBlue, OUTPUT);
pinMode(ledWhite, OUTPUT);
}
void loop() {
{
delay(10); //Delay added to make thing stable
voice += c; //Shorthand for voice = voice + c
}

{
if(voice == "red")
{
digitalWrite(ledRed,HIGH);
delay(9000);
digitalWrite(ledRed,LOW);

}
else if(voice == "green")
{

digitalWrite(ledGreen,HIGH);
delay(9000);
digitalWrite(ledGreen,LOW);
}
else if(voice == "blue")
{

digitalWrite(ledBlue,HIGH);
delay(9000);
digitalWrite(ledBlue,LOW);
}
else if(voice == "white")
{

digitalWrite(ledWhite,HIGH);
delay(9000);
digitalWrite(ledWhite,LOW);
}
voice=""; //Reset the variable after initiating
}}
Рекомендации по теме
Комментарии
Автор

bro i'm getting error in the IDE, some avrdude: programmer not responding 😢😢

ameenahmed
Автор

It's amazing bro😱 can I have the code ? I want to try it

omronnixt.quicay
Автор

good but normal people connot make it its hard for them

mr.creator