Defective product exchange
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67454
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Defective product exchange
@Chiron: please post a new thread under "Other Adafruit Products". Trying to handle multiple issues in a single thread simply invites confusion.
- Franklin97355
- Posts: 23912
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Defective product exchange
Chiron, if you are having a problem different than the original one in this thread please start a new thread so as not to confuse the original issue of this thread.Please advise.
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Defective product exchange
@chiron, please start a new thread for your topic.
- johngiles
- Posts: 7
- Joined: Thu Mar 13, 2014 7:43 pm
Re: Defective product exchange
I figured out the source of my grief, so I wanted to post it in case someone else runs into the same headache. I was trying to read the data from the UART one line at a time (or as much data as was available) with a single read. I noticed that the Blank sample program was reading a byte/writing a byte as they became available, and it worked perfectly. So the approach I took was to read the data into a string buffer, and then parse the buffer when it contained a '$' and a '\r' or a '\n". Works pretty much perfectly now. Here's the code I use to fill the buffer (you'll need to init the buffer in your setup code to a null string):
And parsing it is pretty easy after that.
Code: Select all
// Read from the UART until it's out of data
iStrLen = strlen(sRXBuffer);
while (GPSSerial.available())
{
sRXBuffer[iStrLen] = GPSSerial.read();
++iStrLen;
sRXBuffer[iStrLen] = '\0'; // Make sure the string is always null terminated
// Just to be safe - we don't want to overflow our buffer
if (iStrLen + 1 >= sizeof(sRXBuffer))
break;
}
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Defective product exchange
Ah! Thanks for the update.
Glad you got it working!
Glad you got it working!
Please be positive and constructive with your questions and comments.