Fipy serial communication PC to Fipy USB/UART
I want to transmit serial data from a PC through USB to Fipy.
I tried to send data in both direction.
On the PC side I am using Python with the Serial library.
On the Fipy I tried to use the Machine.UART class and the print() function.
What did work?
- Connecting to the serial port in my case on Ubuntu /dev/ttyACM0
- Sending serial data from Fipy with the print() function and receiving it on the PC side
What did not work?
- Sending data to Fipy
Why does the serial communication only work in one direction?
I know that Fipy uses 2 UART interfaces where UART1 is used exclusive for REPL and UART2 for the LTE module.
Is there a way to send a byte stream from the PC to Fipy through USB?
Thanks a lot. It works with sys.stdin.read() and sys.stdout.write().
robert-hh last edited by
@steph You can use sys.stdin.read() for receiving and sys.stdout.write() for sending. However, sys.stdin.read() is blocking and there is not way to tell that characters are waiting to be read. You can as well use UART 0 at a speed of 115200, which is the USB/UART interface.