1

The basic ESP32 Arduino Bluetooth Serial example pairs and connects as expected, BUT once I disconnect the Bluetooth terminal it stops responding to new events at all,

once I reset the esp32, it starts working again with the same problem. (it doesn't matter if it keeps being paired or not)

I have tested it with the windows Bluetooth terminal and with the Bluetooth Any terminal. (from the windows store)

I have downloaded the latest esp32-Arduino library from GitHub and I still get the same problem.

I have tested it with several esp32 modules, and they all respond with the same problem.

So it looks like a bug in the library code.

See the simple Arduino example code below:

#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!"); }

void loop() { if (Serial.available()) { SerialBT.write(Serial.read()); } if (SerialBT.available()) { Serial.write(SerialBT.read()); } delay(20); }

Does anyone know of another Bluetooth serial library that does work?

Thank You!

2
  • have you looked at the SerialToSerialBTM example code? ... it shows disconnect and reconnect – jsotola Mar 23 at 22:40
  • The SerialToSerialBTM example is for Bluetooth master mode, and not client mode – Elazar M Mar 24 at 18:43
1

Nothing wrong with your code, I've the exact same issue as you have. It bothers me whole week long and fortunately, we (along with my colleague) accidentally figured that was caused by Windows 10, weird right? We don't believe it at very beginning either, but after several back-N-forth testing, it just like that. When we upload exact same code from another older computer with Windows 7 OS, it just works no matter how many time we connect/disconnect or even "QUIT" the APP without make it disconnect properly, its been able to be reconnect no problem. But once we use new computer with Windows 10 OS to upload the code, it can only be connected for first time, then stop broadcasting (or advertising). The arduino official website in IDE download page also has a notice message "IMPORTANT: This app performs with core functionality on Windows 10 S but some limited plugins do not work. We are working with Microsoft on a fix.", hope this information helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.