View Single Post
  #7  
Old 06-22-2010, 12:04 PM
nige777 nige777 is offline
Member
 
Join Date: Nov 2007
Location: UK
Posts: 78
Thumbs up

Thanks for the heads up there Wayne, as you suspected my serial settings were wrong however readline() would still not work correctly with 'NMEA out' enabled but work fine with 'Text out'!
However I have ended up using the following approach - Thanks StackOverflow
Code:
buffer = ''
while True:
	buffer = buffer + ser.read(ser.inWaiting())
	if '\n' in buffer:
		lines = buffer.split('\n') # Splits buffer block into lines
		last_received = lines[-2]
		buffer = lines[-1]
		print last_received
which is working pretty much how I want it to

Last edited by nige777; 06-22-2010 at 12:08 PM.
Reply With Quote