0

i'm trying to read and write data from serial port.i'm reading and writing data separately.It's OK.However when i was writing data to serial port in python with "input" function,i want to read data from serial port in same time.even if the data that are sended with input function,are not insert or empty,in backgroud python read data from serial port.How can i do it?Could you help me please?

HHU
  • 1
  • 1
  • 1
    Although it's experimental, you might be able to try Threading or Asyncio from PySerial. [pySerial API](https://pyserial.readthedocs.io/en/latest/pyserial_api.html) – kunif Jun 26 '20 at 08:25
  • i had tryed Threading but i could not achieve.Could you give a example on code for Threading or Asyncio. – HHU Jun 26 '20 at 13:44
  • These articles may be helpful. [PySerial non-blocking read loop](https://stackoverflow.com/q/17553543/9014308), [Python 3 non-blocking read with pySerial (Cannot get pySerial's “in_waiting” property to work)](https://stackoverflow.com/q/38757906/9014308), [How to check simultaneously for serial input and input from keyboard (simultaneous use of readchar and serial library)](https://stackoverflow.com/q/58615285/9014308), [Read from two serial ports asynchronously](https://stackoverflow.com/q/37505062/9014308) – kunif Jun 26 '20 at 14:15

0 Answers0