Reading Integers over BLE not working

Make sure that your device is also sending a multiple of 4 bytes. The ReadIntegers block attempts to process the BLE payload as a little endian 4 byte wide number. If you only send, e.g., 3 bytes, then it won't work.

An effective work-around is to convert your integers to strings with sprintf() and write to the App with a string Characteristic.


After some test with labels to know witch function is called, the BytesReceived is launch each time a read bytes/integer the app ask for the values.
The right part never triggers! :face_with_monocle:
Perhaps i should only work with integers instead of the two types of var.

I also tested multiple ways to test Uuid, some folks inthe forum compare the uuid directly with the global var (String) while others compare text. Strange!

Expatton, when i check the data send by the arduino with NrfConnect, it seems fine.

There is a Length of List block that can be used to tell you how many bytes are in that incoming byteValues list variable.

You could test if you got 4 bytes, then combine them in a Little Endian manner into an integer.

Hello,
I was involved in the same problem. I solved it by alternatively using the BluetoothLE.BytesReceived event.

Then I got the INTEGER number (name hand in my app) in the following way when BluetoothLE.BytesReceived event,

And I changed from BluetoothLE.RegisterForInteger to BluetoothLE.RegisterForBytes (from unsigned integers to unsigned bytes)

1 Like

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