Led project issue

Hello, I am new to this forum and arduino programming. I have a question regarding the arduino code that relates to my project.

The thing is, I am trying to use an android app to remote control the led brightness through bluetooth, however, I just couldn't to get my code right no matter how hard I work on it. Can someone please help me on this ?

[Note: I am using the slider feature on the app, the min value of the slider is set to 0 and the max is 255]

My code:

char value = 0; //Variable for storing received data
int dimled=9;
void setup()
{
Serial.begin(9600); //Data bits rate per second for HC-05 bluetooth device
pinMode(dimled, OUTPUT); //Make pin 9 as individual output power

}
void loop(){

if(Serial.available() > 0) // Send data after receive signal:
{

value = Serial.read(); //Read the incoming data
Serial.println(value) ; //Print Value inside data in Serial monitor

analogWrite(dimled, value); //LED brightness control
}
}

So, basically my current code is able to trigger the led from off, but no matter how I drag the slider to send the input, the light's brightness won't change , and it won't turn off when I drag the value to 0.

You need to understand that, since you used the char data type for your value variable, this line:

Serial.println(value) ;       //Print Value inside data in Serial monitor

Is going to print the ASCII character representation of the data read.

But this line:

analogWrite(dimled, value);  //LED brightness control

is using the decimal value of the read data. So what you're seeing in Serial Monitor and what you're writing to the pin are two different things. I recommend changing this line:

char value = 0;                //Variable for storing received data

to:

byte value = 0;                //Variable for storing received data

Then the debug output you see in Serial Monitor will match what is actually happening. After doing that, I think the debug output will show you what the problem is.