I use Bluetooth to control LED,but LED can not turn off I use android to send the data to Arduino. when i send 0x02, LED turn on, and the breathing LED code are work. But when i send 0x03, it can not turn off the LED. i use UNO R3 the bluetooth is HC06

char data;
void setup()
{
  Serial.begin(9600);
  pinMode(9, OUTPUT);
}

void loop()
{

  if (Serial.available())
  {
    data = Serial.read();

  switch(data){

    case 0x02:             

      for (int a = 0 ; a &lt; 255; a=a-1){  
        analogWrite(9, a);
        delay(10);
      }
      for (int a = 255; a&gt;0; a=a-1){  
        analogWrite(9, a);  
        delay(10);  
      }  

      break;
    case 0x03 :  
      digitalWrite(9, LOW);
      break;
    default:
      break;
    }
  }
}
this may be because of using digitalWrite in 0x03. Try using analogWrite(9, 0); instead.