UART P0 and P1



  • Hi People

    I'm working on a project using the LoPy for its LoRa communication, but the important thing is that it interacts with the other components through UART (technically only a single microcontroller but that interactions with all other components).
    Naturally, I would need like most operations to be non blocking. I know, I can acheive it using uart.any().
    However, as of now, it is connected through Pin 0 and 1, which is also the Pins where there REPL loop connects to.
    As such I cannot instantiate the UART for these pins, and I cannot acheive this non blocking operation of the system.
    Is there any way to either manually create the UART for these pins to have the UART-object or otherwise use input() or sys.stdin in a non blocking fashon?

    Thanks beforehand!



  • @Zinoex You can open UART0 like any other uart, even if it is used by REPL, and use uart.any() for checking, whether a character arrived. REPL is only active when no code is running. Be aware that this channel is not fully transparent, since by default the input stream is still checked for Ctrl-C and Ctrl-F. You can deactivate this test off by calling micropython.kbd_intr(-1).


Log in to reply
 

Pycom on Twitter