#include "BluetoothSerial.h"
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth nao esta habilitado! Execute a configuracao do bluetooth
#endif
BluetoothSerial SerialBT;
void setup()
{
Serial.begin(115200);
SerialBT.begin("ESP32_01"); //Nome do Bluetooth
Serial.println("Conectado com sucesso");
}
void loop()
{
if (Serial.available()) //Verificar se chegou dado pela Serial
{
SerialBT.write(Serial.read()); //Enviar dados para o celular através da Serial
}
if (SerialBT.available()) //Verificar se chegou dado pelo bluetooth
{
Serial.write(SerialBT.read()); //Exibir na Serial
}
delay(50);
}