HC-06 Led control using app

Hello guys, recently i have bought Bluetooth module HC-06 for my Mega.I was figuring out for like few days how it works and how i can write simple script to control the LED with an android app.It didn't went well as i thought it would be.I searched the whole web and i founded the arduino code which actually works.So, when i press the button on my app to turn on the LED it works , but in the same session and in the same app , few secounds later when i clicked button to turn the LED off it won't work.I reseted my Mega, and repeated the whole process.It always lights up and whenever you click the OFF button it won't do the work.

I checked the arduino code and the code for app , there are no bugs , app sends 1 to light and 0 to turn off the led, Module recive the 1 to light it up and it won't recive the 0 to turn it down.

What's the problem?

I would be really happy if someone could figure out what is the problem and how should i solve it.

Salute from Serbia :slight_smile:

SenSus:
What's the problem?

I would be really happy if someone could figure out what is the problem and how should i solve it.

My crystal ball is not working today.

Hahahhahaha

No

ieee488:
My crystal ball is not working today.

Means how the hell can I tell where you have made a mistake without seeing your code.

Personally line 20 looks wrong, but it might be line 32.