Bluetooth connection problem

Hello everyone
After having carried out several searches and not finding what I was looking for, I am taking the liberty of posting this request.
I want to create a link between an application and a device connected via Bluetooth.
Concerning the scan and the connection, everything is ok.
However, I cannot receive data from the device and register it on a list. I managed to do this on App Inventor but couldn’t reproduce it on Thunkable. I’ll show you the block that works on App Inventor as well as what I did on Thunkable. I hope someone can help me.
Thanks in advance.


Hi auroremalvautl, welcome to Thunkable! :tada:

Be sure to check out our posts about How to ask Great Questions v2.0, our Community Guidelines, and our Docs as you get started.

Could you please include the output of the error block(s) when you are receiving data? It will be very difficult to troubleshoot without that error message.
Screenshot 2024-06-25 at 9.47.56 AM

Hi matt_conroy,
First of all thank you for your reply. Sorry if any information is missing.
There are no real errors when I launch the application.
I would like information to be displayed on my application when I interact with my device. For example if I press a bluetooth button, on my application it displays Pressed on DATE, TIME.
Currently, even without interaction, the message “Read failed” is displayed. So as soon as the timer is started.
I think the “Received Byte array” part is not useful for me but I tried everything :frowning:

Thank you again for your help. I’ll give you an image of all the blocks I’ve put in so far.

Can you ensure the the device settings for receiving data are correct?

For the date time issue, you can just use the device blocks to create a basic timestamp on any button click

It works perfectly on App Inventor so yes I am sure of the device settings.
My concern is the blocks on Thunkable. Because on the application it is impossible to receive data when I use my device.
To make it simpler, I would like that when I press the button on my Bluetooth device (and only when I press the button on the device), my application receives data and writes me the date and data received in a list (by saving this data in a database).
Or the equivalent of this (App Inventor):

At this point, to help troubleshoot the receiving data issue, it is probably best to simplify the process. Can you connect to the device via one button click event and then use the receive data (whether that be string or byte array or whatever data type your device uses) and implement error handling and letting us know what the error you receive is?

Screenshot 2024-06-25 at 9.47.56 AM

I haven’t had time to look into it. I see this next week at the latest.
Thank you again for your help.

1 Like

Good morning,
I changed my block for receiving data. Unfortunately, it is impossible to do tests with my device. It is no longer detected on Bluetooth. I have to check this out with a friend who set it up next weekend.
But it seems to me that the last time I tested this block, it displayed “Echec” (text written in the block) and even if I pressed the button on my device it didn’t change anything. No data reception.
Concerning the “error” variable, I would like it to correspond to the non-reception of data (i.e. when I do not press the button on my device)
I don’t understand why it works with AppInventor and not with Thunkable :frowning:
Do you have any idea why this isn’t working?


Bluetooth issues, because the devices can all be very different, are almost impossible to troubleshoot without being able to connect to the device and without adding in error handling.

It will helpful to add error handling on the attempt to connect to the device,

and when receiving the string. You can attach the green error block directly to Label1 and that will tell us a lot more and be very helpful with troubleshooting.
Screenshot 2024-07-05 at 9.45.20 AM

Hello Matthew,
Sorry it took so long to get back to you but I just got my button back with the bluetooth working :slight_smile:
I modified my block as you suggested. But my problem is still the same:
no message appears when I press the button on my device

Voici ce qui s’affiche sur mon application:

The word “Echec” corresponds to this part of the block:

What should I change so that it changes when I press the button on my device?

Thank you in advance for your feedback :slight_smile:

Instead of connecting the variable Echec to Label1 when there is an error, can you directly connect the same green error block? So Label1’s text will be join Echec and the green error block. This will give us the specific error to better help troubleshoot. Thanks!

Thanks for your answer. And this is what it gives:

Can't read the characteristic provided issues are usually related to the UUID used when connecting. Without knowing the specific device, this is usually corrected by updating the service ID used.

Thank you so much. I’ll see where the error is in the UUID :slight_smile:

I just checked and everything is correct in the UUID.

Here is an example of what is currently implemented in the code for testing UUIDs:

// UUIDs for the BLE Service and Characteristics
#define SERVICE_UUID “4fafc201-1fb5-459e-8fcc-c5c9c331914b”
#define CHARACTERISTIC_UUID “beb5483e-36e1-4688-b7f5-ea07361b26a8”
#define BATTERY_CHARACTERISTIC_UUID “cba1d466-344c-4be3-ab3f-189f80dd7518”
#define STATUS_CHARACTERISTIC_UUID “19b10010-e8f2-537e-4f6c-d104768a1214”

The device is basically made up of an ESP32, it takes care of the Bluetooth part

Apparently this was the variable that was causing the problem. However, still no reaction once I press my ESP32 button :frowning:

Nothing is displayed this time on the application. The label remains empty.