Converting BLE byte values

So I'm trying to make the sent byte values to the app convert into their true values. I'm using the BLE extension in order to receive the values from the Arduino. I must use byte values for my purposes. How should I go about converting?
Screenshot 2024-01-10 224454

To convert a list of byte values, you must know what data type was sent.

Show the Arduino code, all of it.


Did your block execute? Did you receive any values, readable or not?

Yes i did, here's a screenshot. It's sending the 4 byte values instead of the actual value.

But the code itself is producing the value i want

You can do calculations on the received bytes:

result = byte0 × 256^3 + byte1 × 256^2 + byte2 × 256 + byte3

How do I interpret the result? It's sent as uint32_t so it should be 32 bits I think

byteValues is an AI2 list, with 4 items, that must be selected one by one.

init local byte0 = select item 1 from byteValues
init local byte1 = select item 2 from byteValues
init local byte2 = select item 3 from byteValues
init local byte3 = select item 4 from byteValues

You're right, 32 bit is 4 bytes. Each byte is a separate entry in the byte list you received from the arduino, as ABG mentioned.

Try this:

where the javascript, that you cannot see completely, is:
window.AppInventor.setWebViewString(String.fromCharCode(

Of course you need to add a WebViewer, but it does not have to be visible. It should be possible to do this without the JavaScript trick, but somehow it never seems to work.

I know this is a super way late reply, but that's how life gets sometimes and I apologize for that. I've already done that but the values I'm getting are in the billions. Is there something else I should be doing?

I'm sorry for the extremely late reply. I've already done that but the values I'm getting are just random symbols. Is there something else I should be doing?

You couldn't avoid all this conversion pain by converting the acceleration to a text value with a println and sending the text?

Or is this a rite of passage?