controlling of led using voice commonds using bluetooth


   Controlling of led using voice commands through  Bluetooth





code for Arduino board

void setup() {
  // put your setup code here, to run once:
pinMode(13,OUTPUT);
Serial.begin(9600);
}
String voice;
String voice1="hi";
void loop() {
  // put your main code here, to run repeatedly:
if(Serial.available()>0)
{
  voice="";
  delay(2);
  voice=Serial.readString();
  delay(2);
  Serial.println(voice);
  if(voice==voice1)
  {
    Serial.println("ok");
    digitalWrite(13,HIGH);
  }else if(voice=="stop")
  digitalWrite(13,LOW);
}
}

OUtput


Comments