Not having a strong programming foundation, pointers are like black magic to me. I get that they reference addresses and stuff but how to use them effectively is confusing for me. I see that when I try to open the file that was created in the Setup function that it isn't done correctly so the program bombs. I am just not sure on how to get that newly created file from setup to the loop. Thanks

I have a tendency to over think things. Thanks for the help. The code now complies which is great but I am still having issues opening the file off the SD card after it is created to add the data to it. At first I thought it was because the name of the file was longer than 11 characters and changed the name to be 11 but I am still not able to open the file. I have closed the previous file before trying to open another one. I am not sure what makes the .open() fail. I have tried all I can think of after looking at the implementation and am at a loss. Here is the code as of now:

// Maximum time between sync() calls in milliseconds. If Serial is always// active, you must provide a way to stop the program and close the file.const uint32_t MAX_TXSYNC_TIME_MSEC = 1000;const uint32_t MAX_RXSYNC_TIME_MSEC = 2000;

// Pin number for error blink LED.// Set ERROR_LED_PIN to -1 for no error LED.const int8_t ERROR_LED_PIN = 22;const int8_t CHIP_SELECT = 53; // Set to 53 cause using with a Mega

if (!logfile.sync()) {//NewSerial.println(TxFileName);NewSerial.println("can't sync to the Tx file");errorBlink(ERROR_TXWRITE);}txSyncTime = millis();

logfile.close();

// Log the RX side *****************************************************************// Get the Garmin RX trafficif (NewSerial2.getRxError()) {errorBlink(ERROR_SERIAL);}

m = NewSerial2.read(buf, sizeof(buf));

if (m > 0) { // If there is something in the bufferlogfile.open(RxFileName, O_WRITE);// Attempt to log the correct time stamp to filenow = RTC.now();logfile.timestamp(T_WRITE, now.year(), now.month(), now.day(), now.hour(), now.minute(), now.second());// Commented this out 3/13/14 to try to get the HEX values saved to the file.//if (logfile.write(buf, n) != n) {//errorBlink(ERROR_WRITE);//}for (int i=0; i<sizeof(buf); i++){if (buf[i]<0x10) {logfile.print("0");}logfile.print(buf[i],HEX);logfile.print(" ");}// Get the current micros timelogfile.print(",");logfile.println(micros());// Don't sync if active.return;}if ((millis() - rxSyncTime) < MAX_RXSYNC_TIME_MSEC) return;

if (!logfile.sync()) {NewSerial.println("can't sync to the Rx file");errorBlink(ERROR_RXWRITE);}rxSyncTime = millis();

logfile.close();}

The Serial output looks like:

Quote

Opening portPort openGR_TX07.csv88888Port closed

I looked at the file name to be sure that was being saved out to the global variable like it should be and it is. So if I am looking at the SD card and trying to open a specific file name why would it fail?