#include "BluetoothSerial.h"
/*
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
*/
BluetoothSerial SerialBT;
void setup() {
Serial.begin(115200);
SerialBT.begin("ESP32test"); //Bluetooth device name
Serial.println("The device started, now you can pair it with bluetooth!");
pinMode(27,OUTPUT);
}
void loop() {
/*if (Serial.available()) {
SerialBT.write(Serial.read());
}*/
if (SerialBT.available()) {
char x=SerialBT.read();
//Serial.write(SerialBT.read());
if(x=='A'){
Serial.write(x);
digitalWrite(27,HIGH);
}
if(x=='B'){
Serial.write(x);
digitalWrite(27,LOW);
}
}
}