Communicate over UART to four HC-05 with micropython #11506
-
Hi together, is it possible to communicate over UART to four HC-05 Bluetooth devices? I know, I have only two physical UARTs (0 and 1), but there are 5 pin pairs, which provide connection to TX and RX. It works, that I can send from RP2040 to bluetooth and it will be shown on the Android app "Serial Bluetooth Terminal". But when I try to send from Android app over HC-05 to RP2040, I can do it only once by UART0 or UART1. If I "re-initialize" UART with waiting 15 seconds after receiving, I can't receive the message. The first UART1 and the first UART0 works but the second UART0 doesn't work and only machine.reset() can make it work again. Only stop the code, doesn't work. I'm using Thonny for print output and to run the code. Version of firmware: rp2-pico-20230426-v1.20.0.uf2 Sample code:
Thanks for you help and regards, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@leubanse I wondered if maybe something is going wrong with re-initialising the UART, but I just tried this:
(Send "there" from the other end of the UART)
(Switch pins over)
(Send "there" from the other end of the UART)
So I think this should work.
When this happens, what do you see? Does the read()/write() fail, hang, return nothing? |
Beta Was this translation helpful? Give feedback.
-
What I observed is, that "test" will be received by both UART0, what is strange, because the pins were changed. I will try a simple example today evening, without functions, only call the UARTs after each other. Let's see. |
Beta Was this translation helpful? Give feedback.
You could try to reconfigure the UART pins after use as machine.Pin objects, which changes it's mode. e.g.
etc.
The assignment is not required