     }
 
     return i;
+}
+
+// handles the command received from BT
+void handleCommand()
+{
+    int state = digitalRead(Handler);
+    if(state == HIGH)
+    {
+        digitalWrite(Handler, LOW);
+    }
+    else
+    {
+        digitalWrite(Handler, HIGH);
+    }
 }
 
 //configure the Bluetooth through AT commands


void setup() 
{ 
    // user PIN 9 for AT mode
    pinMode(9, OUTPUT);
    digitalWrite(9, HIGH);
  
    Serial.begin(9600);   //Serial port for debugging
    pinMode(RxD, INPUT);    //UART pin for Bluetooth

#define RxD 2
#define TxD 3

#define Handler 13

SoftwareSerial blueToothSerial(RxD,TxD);//the software serial port 

