import serial
arduino = serial.Serial('COM12', 9600, timeout = .1)
arduino_data = [] # declare a list
while True:
data = arduino.readline()
if data:
arduino_data.append(data) # Append a data to your declared list
print arduino_data
I wonder when there is no more new line from Arduino side, how can i jump out the while loop?
while True:
data = arduino.readline()
if data:
arduino_data.append(data) # Append a data to your declared list
print arduino_data
break
It only works for 1 line.