Khul Jaa Sim Sim

TLIOB009

One day Jugaadu was watching "Ali baba and the 40 Thieves" and he watched a scene that a cave opens only when someone spells particular words in front of it. He liked the scene and he thought of making such a prototype. Can you help Jugaadu to make such a prototype?
NETWORKING KIT
  1. Connect Bluetooth module with Arduino, and servo motor connecting wires on breadboard.
  2. Program the Arduino and upload the sketch Using A to B USB Cable.
  3. Install the App in smartphone to send vocal commands doing necessary settings in it.
  4. Connect Bluetooth with the app and test it.

    

#include <SoftwareSerial.h>

#include <Servo.h>

Servo myservo;

String value;

int TxD = 11;

int RxD = 10;

int pos = 90;

SoftwareSerial bluetooth(TxD, RxD);

void setup() {

Serial.begin(9600);

bluetooth.begin(9600);

myservo.attach(9);

}

void loop() {

Serial.println(value);

 if (bluetooth.available()>0)

{

value = bluetooth.readString();

if (value == "aabra ka daabra")

{

Serial.println(pos);

myservo.write(90);

}

while(value=="khul ja sim sim"){

if (bluetooth.available())

{

value = bluetooth.readString();

Serial.println(value);

if (value=="aabra ka daabra")

{

myservo.write(90);

break; 

}

}

pos++;

delay(30);

Serial.println(pos);

myservo.write(pos);

if (pos ==90 )

{

pos=0;

break;}

 } 

 }

 }