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
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?
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/
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.
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 .
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.