# \[Resolved\] Error in transmit/receive on BLE

**URL:** <https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667>\
**Category:** Issues / Bugs\
**Tags:** problems\
**Created:** [April 10, 2022, 6:53pm UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667 "2022-04-10T18:53:11Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![davew3q](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@davew3q](https://community.thunkable.com/u/davew3q)\
**Post date:** [April 10, 2022, 6:53pm UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667/1 "2022-04-10T18:53:12Z")

</div>

Hi

I’m playing around with BLE connection, and I can scan, find devices, and then connect. But afterwards, any use of the BLE transmit or receive causes the Thunkable app on my phone to “reset” (using a Pixel 6).

I’ve tried all combinations on the UIUD string (dashes included, lower-case, upper-case). I’ve also tried byte-array TX, and receive, but it crashes.

Does the receive string - send the read request, and then wait for the return packet? Any problems with BTLE read response? I’m at a loss.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/d/4d700d9ed27d22980f8c678eaaa4d65cdbbe887b.png)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [April 10, 2022, 7:27pm UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667/2 "2022-04-10T19:27:59Z")

</div>

Welcome to Thunkable.

Thunkable only reads from a characteristic UUID that has the **read** property active.

---

<div class="post-metadata">

**Author:** ![davew3q](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@davew3q](https://community.thunkable.com/u/davew3q)\
**Post date:** [April 10, 2022, 9:09pm UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667/3 "2022-04-10T21:09:08Z")

</div>

Interesting, so I’ve had multiple things going wrong:

- First, my experiments weren’t updating the live app (I had to start changing a label on the designer screen to get code changes). So I was making changes, but not testing new code.
- Second, it now appears it crashes using either Transmit/Receive with the byte array format, and it works with the String format
- I can create the HEX byte array using the list field and integers. I.e. it now send 0x0602 over the air.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/6/4623f619b6bae4816c78b5f5d1152055ff55c495.png)

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [April 11, 2022, 7:31am UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667/4 "2022-04-11T07:31:35Z")

</div>

> [@davew3q](#):
>
> my experiments weren’t updating the live app

When using Thunkable mobile app you need to keep the app open with your project loaded and the mobile does not go in sleep mode (display off). You will notice whatever changes you do in the project will cause the project to reload inside the Thunkable app. This becomes more apparent in design changes but the same goes for coding changes. The changes may take few seconds to take effect.

If your project has more than one screen and you are trying to test any screen other than the first screen then you will notice just few seconds after your changes, the app reloads and goes back to the first screen.

> [@davew3q](#):
>
> it crashes using either Transmit/Receive with the byte array format

The block says **data (string)** which means it expects **text** not an array (list). Just try with text string instead of list of numbers.

If the receiving device expects HEX then you might see this example to help you convert your input.

[https://x.thunkable.com/projectPage/61742edbc7e59500107319d4](https://x.thunkable.com/projectPage/61742edbc7e59500107319d4)

---

<div class="post-metadata">

**Author:** ![davew3q](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@davew3q](https://community.thunkable.com/u/davew3q)\
**Post date:** [April 13, 2022, 2:46pm UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667/5 "2022-04-13T14:46:43Z")

</div>

Thanks for your help on the code updating, going back to the screen helped.

The BLE TX is working now with the list, but I’m still debugging on the “Receive Byte Array” array in this post:

> [@Why does BLE Receive String work, and BLE Receive Byte Array not work](https://community.thunkable.com/t/why-does-ble-receive-string-work-and-ble-receive-byte-array-not-work/1831529):
>
> So I’ve faced some issues with a BLE read, and here is the best summary I have: “Receive String” works on a READ characteristic “Receive Byte Array” returns on error on the exact same characteristic. Here is my case, I can connect to a BLE device, and then read on a button click. Using a counter, I can alternative between the two reads. The read string version returns the data, but the Receive Byte array always flags an error. Ultimately, I need the Read Byte Array for my application, but I…

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [April 13, 2022, 2:55pm UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667/6 "2022-04-13T14:55:04Z")

</div>

Have you seen this?

> [@\[Solved\] Bluetooth LE Transmit Byte Array](https://community.thunkable.com/t/solved-bluetooth-le-transmit-byte-array/685541/6):
>
> edit 1: attached screenshots edit 2: attached screenshot of the receiving blocks @Paolo_Tealdi & @shawnmccazl thanks to [this comment](https://community.thunkable.com/t/how-to-receive-and-show-text-ascii-with-ble/404694/20) by @gaston_fabbietti I have also solved how to READ data over BLE - the answer is annoyingly self-explanatory: the characteristic has to be set up with the READ property and NOT the NOTIFY or INDICATE (which is usually the default). As an example, I am (still) using the [RN4871 module from Microchip](https://www.microchip.com/en-us/product/RN4871) - although the RN4870 is functionally identical for the purpose…

---

<div class="post-metadata">

**Author:** ![davew3q](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@davew3q](https://community.thunkable.com/u/davew3q)\
**Post date:** [April 13, 2022, 3:19pm UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667/7 "2022-04-13T15:19:49Z")

</div>

Yep, the GATT characteristic definitely has a READ property, I’ve confirmed the UIUD is marked as a READ with a separate BTLE utility on the phone.

---

<div class="post-metadata">

**Author:** ![abrotzman4598f5a4](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@abrotzman4598f5a4](https://community.thunkable.com/u/abrotzman4598f5a4)\
**Post date:** [April 14, 2022, 11:25pm UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667/8 "2022-04-14T23:25:35Z")

</div>

1. is the characteristic UUID a 128-bit one? Not sure if this is mandatory, but my working example used this. Again, check things like dashes are in the right places etc. (not being patronising, just things to double check).

2. Is the characteristic EXCLUSIVELY READ, or does it just include READ? I’ve only tested on the former.

---

<div class="post-metadata">

**Author:** ![davew3q](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@davew3q](https://community.thunkable.com/u/davew3q)\
**Post date:** [April 15, 2022, 12:04am UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667/9 "2022-04-15T00:04:33Z")

</div>

No problem! It’s sometimes the littlest things that trip you up.

1. Yes, it’s a 128-bit UUID, I spent some time with the dashes to get the Receive stream version working

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f87fc3ecdd588905da96ea1a7aa5c2fe9fd624f.png)

1. This characteristic is just a READ (no notify or indication possible either). Of course once this works, I want to move onto notifications for another UUID, but baby steps for now.

---

<div class="post-metadata">

**Author:** ![abrotzman4598f5a4](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@abrotzman4598f5a4](https://community.thunkable.com/u/abrotzman4598f5a4)\
**Post date:** [April 15, 2022, 12:39am UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667/10 "2022-04-15T00:39:15Z")

</div>

Okay, well that’s not the issue then (could be good or bad news). My next thinking is what is the data type is the thing you’re reading? I can’t remember if I tested sending numbers as part of the receive string demo that I got working. Even if I did, it might be encoded differently (i.e. as ASCII characters rather than direct values).

You could try using the receive byte array example that I posted later on in the previously linked thread, but that is an untested example and may need some modification to work (assuming that block even does in the first place, of course). This might work better for reading actual numbers directly, although I have no idea of its limitations (only values 0-255 etc.).

If you do decide to experiment with that, remember that it will only work if it’s initially treated as a list, even if that list only ends up containing one element.

---

<div class="post-metadata">

**Author:** ![davew3q](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@davew3q](https://community.thunkable.com/u/davew3q)\
**Post date:** [April 18, 2022, 1:03pm UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667/11 "2022-04-18T13:03:16Z")

</div>

Thanks, I’m got a picture from your post on building a list from the output. In my case, the “Receive Byte Array” is throwing out an error before I can even get to the data.

---

<div class="post-metadata">

**Author:** ![abrotzman4598f5a4](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@abrotzman4598f5a4](https://community.thunkable.com/u/abrotzman4598f5a4)\
**Post date:** [April 18, 2022, 8:51pm UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667/12 "2022-04-18T20:51:03Z")

</div>

That is unfortunate, if I remember correctly, the error messages (for the BLE blocks at least) are uninformative at best?

Do you have any control over what’s stored in the characteristic? If so, then you could try changing it to an ASCII string on the device side so that the app can read the string. If not, then I’m not sure what to suggest.

---

<div class="post-metadata">

**Author:** ![davew3q](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@davew3q](https://community.thunkable.com/u/davew3q)\
**Post date:** [June 27, 2022, 1:40pm UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667/13 "2022-06-27T13:40:17Z")

</div>

Thanks, it looks like the issue now resolved with the June 2022 Live App update! You can directly read “Receive Byte Array” with the BTLE components and receive the correct bytes.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [June 27, 2022, 1:51pm UTC](https://community.thunkable.com/t/resolved-error-in-transmit-receive-on-ble/1827667/14 "2022-06-27T13:51:24Z")

</div>


