Defective product exchange

Forum Administrative - NOT PROJECT OR "HELP"

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Defective product exchange

Post by adafruit_support_mike »

@Chiron: please post a new thread under "Other Adafruit Products". Trying to handle multiple issues in a single thread simply invites confusion.

User avatar
Franklin97355
 
Posts: 23911
Joined: Mon Apr 21, 2008 2:33 pm

Re: Defective product exchange

Post by Franklin97355 »

Please advise.
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.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Defective product exchange

Post by adafruit_support_bill »

@chiron, please start a new thread for your topic.

User avatar
johngiles
 
Posts: 7
Joined: Thu Mar 13, 2014 7:43 pm

Re: Defective product exchange

Post by johngiles »

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):

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;
     }
And parsing it is pretty easy after that.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Defective product exchange

Post by adafruit_support_rick »

Ah! Thanks for the update.
Glad you got it working!

Locked
Please be positive and constructive with your questions and comments.

Return to “Administrative (closed)”