Receiving Bytes with BLE Extension

Hi all,

I'm trying to design a user interface app for a design project. The app is supposed to be able to connect via Bluetooth Low Energy to an external microcontroller (we are using a BlueNRG-LP development board) and send and receive bytes of data based on the user's activity.

I've posted about this same code before, in a question I posted here: BLE add on - "Register for Bytes" block crashes code

Since then I have modified the code, and the app now successfully transmits and receives data. The trouble I am encountering, however, is in interpreting the sent and received data.

When I send data to the BlueNRG-LP chip (such as 0xABCD), the chip can receive only the last two characters, preceded by six F's (0xFFFFFFCD). This is fine, as I can get by only sending it two characters, but I don't know why it happens, and it might be related to the real issue I'm having.

The more pressing issue I'm encountering is in receiving data on the app from the BlueNRG-LP. When we send data from the chip (for example, the same 0xABCD), the "WhenBytesReceived" block is called, and the byte values go into a text label I put there for testing. However, the values are displayed as a very small decimal number, such as 7.8869E-41. It also displays as an array with only one value.

Does anyone know a way I can convert this data back into the original hex, or extract the message in some way? I have a feeling I'm not doing it right.

Here is my code as of right now, for reference:

Any help would be appreciated. Thanks!

It would help if you were to also include the transmission code, so we can see the data format that was sent to AI2 on its way into BLE.


Capture1

The byteValues return value is always a list in the BytesReceived event.

Asking for base conversion of a list is beyond AI2's capabilities, as my added experiment demonstrates.

How did you get past that error message?

Here is a value procedure that can convert a bytes list to a piece of hex text ...

bytes_to_hex_test_Capture


The last 2 blocks are draggable directly into your Blocks Editor workspace.