//Prueba Bluetoth Clasico en ESP32
// Probado y funcionando falta linkearlo a una aplicacion y ya
// se probo con la aplicacion Serial Bluetooth Terminal
#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;
char dato;
#define LED 2
void setup() {
Serial.begin(115200);
SerialBT.begin("BT PROFE JUAN"); //Bluetooth device name
Serial.println("The device started, now you can pair it with bluetooth!");
pinMode(LED,OUTPUT);
}
void loop() {
if (Serial.available()) {//si hay un dato valido en el serial
SerialBT.write(Serial.read());
}
if (SerialBT.available()) {//si hay un dato valido en el serial Bluetooth
dato = SerialBT.read();
Serial.println(dato);
if(dato == 'R')
{
digitalWrite(LED,HIGH);
}
else if(dato == 'L')
{
digitalWrite(LED,LOW);
}
}
delay(500);
//SerialBT.println(touchRead(T0));
}