Not Received Text from Esp32 with classic bluetooth [solved]


As I am a beginner on App Inventor and the Esp32, I have a problem that I cannot solve.
I made a program that I scaled down just to show the problem.
I manage to send a text from the smartphone to the esp32 with a classic bluetooth but not the other way around.
I am using a nodemcu esp32 from Az delivery
and I configured the arduino IDE as indicated on their site

For App Inventor, I started with @Juan_Antonio 's examples

testBT.aia (716.0 KB)

By pressing the Test button, the bluetooth connection is created and the message 'SendToEsp32' is sent to the esp32. It works.
Then the esp32 sends the message "SendToSmartphone" is sent to the smartphone, but there I do not receive anything and I do not understand.

Any help would be much appreciated

[EDIT] Solved, I miss to put a delimiter to 10 for the bluetooth client!

Esp32 light code:

#include "BluetoothSerial.h"

BluetoothSerial SerialBT;

void connectBluetooth() {
  ;  //Bluetooth device name
  if (SerialBT.begin("Horloge")) {
    Serial.println("Bluetooth initialized");
    Serial.println("The device started, now you can pair it with bluetooth");
  } else {
    Serial.println("An error occurred initializing Bluetooth");

void btCallback(esp_spp_cb_event_t event, esp_spp_cb_param_t *param) {
  if (event == ESP_SPP_SRV_OPEN_EVT) {
    Serial.println("Client Connected!");
  } else if (event == ESP_SPP_DATA_IND_EVT) {
    Serial.printf("ESP_SPP_DATA_IND_EVT len=%d, handle=%d\n\n", param->data_ind.len, param->data_ind.handle);
    String received = bluetoothReadLine();

String bluetoothReadLine() {
  String text_received = "";
  while (SerialBT.available()) {
    byte r =;
    if (r != 13 && r != 10 && char(r) != '\0')
      text_received = text_received + char(r);
  return text_received;

void writeSerialBT(String respuesta) {

void setup() {

void loop() {

where do you start ClockBT2? or did you enable it already in the designer settings?

thanks Taifun for your reply.
No the timer is disable in the designer settings

then obviously you first should enable it before being able to receive something

Perform the indicated example: 2.- App sends a message to ESP32, remember to put the Delimiterbyte: 10

Once that example works for you, adapt it to your project.

1 Like

Yes, a small bug at the end, well seen
I hadn't made a clockBT2 timer at the start and it didn't work (the bluetoothClient1.receivetext function was in the ClockBT1 timer.
I added this and it doesn't work

Yes! Thanks a lot, you are my savior :heart_eyes: I didn't put a delimiter, now it works! (I try to find a solution since yesterday!)
(Thanks also to @Taifun :wink:)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.