Serial port does not work in rewritten Python code
问题 I have a Python program that reads some parameters from an Arduino and stores it in a database. The serial port is set up and used like this: ser = serial.Serial(port=port, baudrate=9600) ser.write('*') while 1 : ser.write('*') out = '' # Let's wait one second before reading output (let's give device time to answer). time.sleep(1) while ser.inWaiting() > 0: out += ser.read(1) if out != '': etc ... handling data (The Arduino is set up so when it receives a star, it sends back a data string.) I