Convert byte array to signed int

I am using Thunkable BLE to interface with an Arduino Nano 33 IoT chip and control a motor. Everything related to sending and receiving information using the BLE blocks is working like a charm. As part of my design, I’d like to receive the motor step position and display this in my Thunkable app.

The problem that I am having is that I am receiving a 4 byte package representing a signed uint32_t integer and I can’t for the life of me figure out how to convert these 4 bytes into a signed int in Thunkable.

The Arduino package being sent is the following:

union {
uint32_t position;
byte packet[4];
} posData;

Written as posCharacteristic.writeValue(posData.packet, 4);

In Thunkable, I can see that I am getting all the bytes (LE) I expect by printing each byte to a label

How can I create the signed integer with these 4 bytes?

Hi pingknapp4n, 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.

Thunkable currently supports receiving data in String and Byte Array format from BLE devices, however we don’t have blocks specifically designed for converting this data. It might be possible, depending on the device(s) and their ability to send this data through String or Byte Array format, however we haven’t tested and verified this so it would require some experimentation