#include <BluetoothSerial.h>
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error name valueerror Bluetooth is not enable! please run `make menuconfig` to and enable
#endif
#define led 15
BluetoothSerial ESP_BT;
void setup() {
Serial.begin(115200);
Serial.println("Inicializando, ESP32!");
pinMode(led, OUTPUT);
ESP_BT.begin("ESP Juan Jose Gonzalez");
Serial.print("La Tarjeta esta Lista para Emparejarse");
}
void loop() {
if (ESP_BT.available()) {
int inData = ESP_BT.read();
Serial.print("Recibiendo Datos: ");
Serial.println(inData);
if (inData == 69) {
digitalWrite(led, HIGH);
Serial.println("Led Encendido por Bluetooth");
}
if (inData == 65) {
digitalWrite(led, LOW);
Serial.println("Led Apagado por Bluetooth");
}
}
}