# App Inventor send byte to soft - uart

**URL:** <https://forum.xod.io/t/app-inventor-send-byte-to-soft-uart/5920>\
**Category:** Uncategorized\
**Created:** [February 25, 2022, 4:34pm UTC](https://forum.xod.io/t/app-inventor-send-byte-to-soft-uart/5920 "2022-02-25T16:34:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![garrin](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@garrin](https://forum.xod.io/u/garrin)\
**Post date:** [February 25, 2022, 4:34pm UTC](https://forum.xod.io/t/app-inventor-send-byte-to-soft-uart/5920/1 "2022-02-25T16:34:51Z")

</div>

I’m sending a byte number from mit app inventor to the soft-uart via a hc-05 Bluetooth module . When I click the button on the app it sends the correct number but if i click the same button again it will send another number which is not correct . If I click the button on the app again 2 or three more times it will send the correct number again . Does anyone have an idea what might be going on ?  
cheers Garrin  
 ![Capture 2](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/b/b5bcdbce7bf86169d6fa514c8251e1ce6134b79a.png)

 ![Capture 1](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/e/eaee611402a47f0cca2cbfdd269e8ddd9ff90747.png)

---

<div class="post-metadata">

**Author:** ![xodballxod](https://avatars.discourse-cdn.com/v4/letter/x/f475e1/32.png) [@xodballxod](https://forum.xod.io/u/xodballxod)\
**Post date:** [February 27, 2022, 10:59am UTC](https://forum.xod.io/t/app-inventor-send-byte-to-soft-uart/5920/2 "2022-02-27T10:59:22Z")

</div>

I’m not sure, but I suspect there is additional bytes sent in the serial message, like a “\n”, or something. Maybe try “Read Line” instead of readbyte. ReadLine was mentioned in this tutorial?

> **[Controlling LEDs via UART — Exchanging Text-based Data Between Two Boards](https://xod.io/docs/guide/uart-led-control/)**
>
> How to exchange data between two Arduino boards and how to control LEDs via UART interface.

Or, just add an additional readbyte, to help clear out what is on the serial buffer. If there is only one message at a time, then you could “flush” the serial buffer. I’m not really sure how softserial works. A regular serial port has some hardware memory that can capture data and hold it until read…

There’s this library, that may be better to use than ReadByte  
[https://xod.io/libs/xod/stream/](https://xod.io/libs/xod/stream/)

I tried to use the soft-uart, connected a wire from D8 to D9, but could not get the soft-uart example to work at all.

---

<div class="post-metadata">

**Author:** ![garrin](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@garrin](https://forum.xod.io/u/garrin)\
**Post date:** [February 27, 2022, 8:33pm UTC](https://forum.xod.io/t/app-inventor-send-byte-to-soft-uart/5920/3 "2022-02-27T20:33:08Z")

</div>

Ok thanks for the reply . On my original example I had a long delay node which I removed and the byte numbers that I receive in XOD now seem correct . I will definitely try the library that you suggested and send a string from the app inventor app .

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/eb7348baa04192c2ef932d1db54d44f09f8a7888.png) [@system](https://forum.xod.io/u/system)\
**Post date:** [March 29, 2022, 8:33pm UTC](https://forum.xod.io/t/app-inventor-send-byte-to-soft-uart/5920/4 "2022-03-29T20:33:27Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
