HC-06 Bluethooth module with android.

I bought this item(Bluetooth RF Transceiver Serial Module) : http://www.ebay.com/itm/291265145410?_trksid=p2060778.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

Im trying to turn off and on led, but it doesnt work. Conected all pins, and using this code:

int ledPin = 13; int state = 0; int flag = 0;

void setup() { pinMode(ledPin, OUTPUT); digitalWrite(ledPin, LOW);

Serial.begin(9600); // Default connection rate for my BT module }

void loop() {

if(Serial.available() > 0){ state = Serial.read(); flag=0; }

if (state == '0') { digitalWrite(ledPin, LOW); if(flag == 0){ Serial.println("LED: off"); flag = 1; } }

else if (state == '1') { digitalWrite(ledPin, HIGH); if(flag == 0){ Serial.println("LED: on"); flag = 1; } } }

If your connection is okay, try this :

int ledPin = 3;   //change pin number if your led is connected somewhere else
String readString;

void setup() 
{
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);     // start serial
}

void loop()
{
    while (Serial.available() > 0) 
    {
    delay(3);  
    char c = Serial.read();
    readString += c; 
    }
        if (readString.length() > 0) 
           {
               if (readString == "LEDon")     
                   {
                    digitalWrite(ledPin, HIGH);
                    }
               if (readString == "LEDoff")
                    {
                    digitalWrite(ledPin, LOW);
                    }                 
                    readString="";
            } 
 }