BluetoothSerial SerialBT; const int LED = 23; char Incoming_value = '0'; void setup() { Serial.begin(115200); Serial.println("ESP32 started"); SerialBT.begin("ESP32test"); //Bluetooth device name Serial.println("The device started, now you can pair it with bluetooth!"); pinMode(LED, OUTPUT); digitalWrite(LED, LOW); } void loop() { if (SerialBT.available()) { Incoming_value = SerialBT.read(); if(Incoming_value == '1') digitalWrite(LED, HIGH); else if(Incoming_value == '0') digitalWrite(LED, LOW); Serial.println(Incoming_value); } delay(50); }