For ESP32 Uart console/keyboard input.
Basically, need advice for non-blocking keyboard input from Uart console port, as scanned 1 character at the time.
input() and sys.stdin are blocking.
Thanks
Non blocking console/keyboard input
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Non blocking console/keyboard input
In general UARTS can operate in a non-blocking mode by using uasyncio StreamReader and StreamWriter objects. See the tutorial in this repo.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Non blocking console/keyboard input
Thanks Peter
I would also like to know if there is a simpler system call to access existing OS keyboard scan.
I would also like to know if there is a simpler system call to access existing OS keyboard scan.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Non blocking console/keyboard input
In general (and in particular on the ESP32) MicroPython runs on bare metal. There is no OS. If you want to connect a serial keyboard to an ESP32 you will need to interpret the data yourself. Unless someone has already posted code to do this.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.