Program to receive data from serial port-
import serial
import time
ser = serial.Serial(
port='/dev/ttyAM0',
baudrate=57600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1)
while 1:
BytesToRead = ser.inWaiting()
x = ser.read(BytesToRead)
print x
Input - @1,12,5,0:0:1# these types of 100 strings per second output - Mixed data with some data missing and jumbled
Note - The strings are received from arduino via zigbee. What am i doing wrong? Is there any delay problem or I am reading the strings wrongly through the serial port?
If there aren't any bytes to read, then you shouldn't try to read or print them.