How to send a 1 Byte Number

How would I send 1 byte numbers on thunkable. There’s a function already preset on MIT App Inventor, but I need to replicate it on thunkable.

image

I know that I will use the transmit function block and that I need the UUID. What I don’t know is how to make it send a 1 byte number. It has the data(string). Am I able to send 1 byte through that somehow? If someone could help me out as soon as possible that would be great.

1 Like

You should always search the forums before posting a question. A Google search for one byte number thunkable resulted in these two topics which look promising:

1 Like

If your receiving device expects a byte number then just use the number from the number drawer, if in the other hand, your device expects a byte array then you need to have the number inside a list.

Sorry, I think that I should be using the Transmit Byte Array block and not the Transmit String. Is that what it would look like to send 1 byte to a BLE device?

That looks like it should work fine to me. I don’t think it actually makes any difference whether you use the “string” or “byte-array” blocks - I believe it’s just to improve readability by sign-posting its intended purpose (remember that a string at least in ASCII, is just a byte array). I’ll add testing this theory to my ‘to-do’ list and report back in my BLE thread.

Sounds good, thank you. Would you know how to return the value of the value TGTMove just like I did on MIT App Inventor?

image

See this post which contains all the knowledge I currently have on reading values over BLE using Thunkable. Unfortunately, it is much more limited than MIT AppInventor. You will need to do your own reading/experimenting to determine whether the service you are targeting is READ ONLY or not. If it is, then you’re okay, if not then you might have to do further reading of documentation to see if there are any AT commands (or similar) which allow you to modify the service to be READ ONLY, or if you can create your own service that is READ ONLY that ‘mirrors’ this value. The latter points are unlikely to work though if this is an ‘off-the-shelf’ Bluetooth product, but might be worth looking into anyway.