#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
//const char *pin = "1234";
BluetoothSerial SerialBT;
void setup () {
Serial.begin(115200);
SerialBT.begin("ESP32"); //Nombre del dispositivo bluetooth
Serial.println("Dispositivo iniciado, ahora puede vincular...");
#ifdef USE_PIN
SerialBT.setPin(pin);
Serial.println("Usando PIN");
#endif
}
void loop() {
if (Serial.available ()) {
SerialBT.write(Serial.read());
}
if (SerialBT.available ()) {
Serial.write(SerialBT.read());
}
delay (20);
}