![sparkfun DEV-16829 Quick Start Manual Download Page 12](http://html1.mh-extra.com/html/sparkfun/dev-16829/dev-16829_quick-start-manual_1339612012.webp)
/*
MicroMod Data Logging Carrier Board - ZOE-M8Q GPS Example
This example code is in the public domain.
*/
#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include "SparkFun_Ublox_Arduino_Library.h"
#define chipSelect = CS //Primary SPI Chip Select is CS for Artemis MicroMod. Adjust for your pr
ocessor if necessary.
SFE_UBLOX_GPS myGPS;
long lastTime = 0; //Simple local timer. Limits amount if I2C traffic to Ublox module.
File myFile;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Wire.begin();
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
{
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezi
ng."));
while (1);
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
Serial.print("Initializing SD card...");
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
while (1);
}
Serial.println("card initialized.");
myFile = SD.open("data.txt", FILE_WRITE); // Create or open a file called "data.txt" on the SD
card
if(myFile)
{
if(myFile.size() == 0) // Only create the header if there isn't any data in the file yet
{
myFile.println("Date\t\tTime\t\tLatitude\tLongitude\tAlt");
myFile.println("MM/DD/YYYY\tHH/MM/SS\tdeg\t\tdeg\t\tmm");