Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Example logging sketch for GPS shield for non-GPS data?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Example logging sketch for GPS shield for non-GPS data?

by trialex on Fri Mar 20, 2009 6:25 pm

Does anyone have a known-good sketch for logging JUST sensor (i.e. non-GPS) data using the GPS shield and AF_SDlog library?

Trying to do some prototyping while I'm waiting for GPS modules. The example sketch waits for valid NMEA data before it will log, even with the "Log without fix" option set.

Thanks!

Alex
trialex
 
Posts: 189
Joined: Mon Apr 03, 2006 6:25 pm

Re: Example logging sketch for GPS shield for non-GPS data?

by acquisition on Mon Mar 23, 2009 4:02 pm

Make sure you comment out all the serial.available code. The example sketches will wait for a valid GPS sentence before logging. You can pull out the part which actually logs to the SD card which is:

Code: Select all | TOGGLE FULL SIZE
 
      // card.write_file(...,...,...)
      //   f is the file handle of the file to which to write.
      //   buffer is the buffer from which to read the data to be written.
      //   bufferidx is the amount of data to write
      //   Returns: The number of bytes written, 0 on disk full, or -1 on failure.
      //****************************************************************************         
      if(card.write_file(f, (uint8_t *) buffer, bufferidx) != bufferidx) {  //log/write to sd card             
         putstring_nl("can't write!");    //card.write_file didnt return correct number of bytes to be written
         return;    //can't write so return
      }

So just make a sketch with that and and the card initializations lines, load up the buffer with the data you want to send, and there you go.

acquisition
 
Posts: 14
Joined: Mon Feb 09, 2009 3:06 pm

Please be positive and constructive with your questions and comments.