#include "BluetoothSerial.h"
BluetoothSerial SerialBT;
const int ledPin = 32;
void setup () {
SerialBT. begin("ESP32-Bluetooth");
pinMode (ledPin, OUTPUT);
}
void loop() {
if (SerialBT.available()) {
char c = SerialBT.read();
if (c == '1') {
digitalWrite(ledPin, HIGH);
} else if (c == '0') {
digitalWrite(ledPin, LOW);
}
}
}