Clear buffer Bluetooth BLE

hello community,
I'm looking for a solution to empty the RX bluetooth BLE buffer because I need a lot of Strings and the buffer slows down the loading.
an idea ?

You could transfer the load from BLE buffering to your app, by adding a global variable InputQueue initially an empty list, and in the BLE Strings Received event

for each **string** in list **stringValues**
   add item **string** to list **InputQueue** 
end for each

then add a fast repeating Clock Timer to test list InputQueue for items, and
apply your single item code to item 1 of list InputQueue before deleting item 1.

What do your color procedures do?
Are they slow?

1 Like

Good evening ABG,
Thank you for coming to my aid once again!
I do not understand everything about your suggestion ...
But I will try to follow your lead.
Concerning the color procedures it is to display texts with appropriate colors.
The slowness starts from ten loads.

Hi @ABG,
I've been racking my brains all day trying your idea ... I didn't succeed.
I think I'll ditch BLE and go back to classic Bluetooth. I wanted it to work with BLE for IOS. anyway the bluetooth client component for IOS is still not developed ...

Hello @ABG,
a little BLE question ...
I know that with Bluetooth BLE we can send a maximum of 20 bytes per packet.
Indeed, when I send 20 letters "A" from App Inventor to an arduino for example, I do receive 20 letters "A".
But, when I send 20 letters "É" I only receive 9 with a waste.
In fact as soon as I send a character from the AscII extended table from 128 to 255 I cannot send 20. It is however always on a byte!
Do you know why ?

When I first saw your query in my Inbox, I wiped the screen at the É to clear the dust off my monitor.

Then I realized that speck on top of the E was part of the letter.

As an American English user, I have been spoiled by the low order of the ASCII table, expecting only one byte per letter.

But extended characters like É are too numerous to fit in the 256 possible slots of the ASCII table, hence coding schemes like UTF-8 and Unicode, which use extra bytes per letter.

Data communication counts out its transmissions by the byte, a uniform measure. (Actually, they call it an octet, to be really sure.)

I'm not sure what you mean by that.

1 Like

Sorry for the dust of the French language on your screen! :rofl:
I understand better now after your explanation and you forget my byte story ...
I managed to transmit sentences in french with a lot of accents everywhere in classic bluetooth mode.
But on the other hand in BLE with the limit of 20 bytes and É Û È À.... it's hard hard!
Thanks @ABG

You can use BLE with max 512 Bytes.
But you have to set a higher MTU Size

1 Like

Hello @F3John
Your ad is like a surprise like dust on a screen ...! :sweat_smile:
can you tell me more please?

517 Bytes MTU Size (5 Byte Header) is the maximum Size with BLE
Minimum Size is 23 Byte (3Byte Header)

So you have do use the Block "request MTU" with a value of 517.
Of course you peripheral should support a higher MTU Size.
Some Devices have a max of 247 or 185.

Which Device is your peripheral?

Thanks @F3John,
HM-10 BLE 4.0

Maybe you know the method to change MTU on arduino?

This Module cant change MTU Size. It's fixed to 23 Bytes (20Bytes Payload)

1 Like

I'am using Arduino with ESP32 (MTU = 517) and NRF52 (MTU 247)

Yes I just found out right away!
I'm running to buy an ESP32 and I'll keep you posted!
Have a good day John

Just to be clear: you will run your code on the ESP32
ESP32 is not really made for connecting to an Arduino board

1 Like

It is noted Jean! I had already planned to try the adventure with this small wifi module and I will therefore take the opportunity to also use its bluetooth!

John ! sorry

you should use the NimBLE Library for ESP32. It has better BLE Features


Hi @F3John,
After our exchange, I ordered an esp32 and an HM-19.
today i got the HM-19, and of course i worked on it right away.
Its MTU is 253 bytes.
If I change the MTU request it works but only when data received in the phone. On the other hand in transmission as soon as I change MTU it no longer sends anything but continues to receive.
Do you know the problem?