OK, I have it working now:-)
I used your example file and stripped out the parts about reading card types and directories, etc. I just want to write some text to a file.
I changed the SD startup command as shown below from your (now modified) file:
// we'll use the initialization code from the utility libraries
// since we're just testing if the card is working!
if (!SD.begin(chipSelect)) {
SerialMonitor.println("initialization failed. Things to check:");
while (1);
} else {
SerialMonitor.println("Wiring is correct and a card is present.");
}
And then to write text to the card I use:
File dataFile = SD.open("datalog.txt", FILE_WRITE);
// if the file is available, write to it:
if (dataFile) {
dataFile.println(dataString);
dataFile.close();
// print to the serial port too:
SerialMonitor.println(dataString);
}
// if the file isn't open, pop up an error:
else {
SerialMonitor.println("error opening datalog.txt");
}
Plus I had to increase the delay waiting for the serial port to initialize. I used 3000 ms but didn't try anything shorter.
I'm attaching the modified file in case you want to poke through it and see what I hacked up:-) I'll clean it out some more and put in a little more of my final needs, a step at a time in case I break something and need to adjust.
Thanks again for the help, tips, ideas.... and for getting me close enough to get things working. It's nice to see the company's paying attention and taking the time to help people along.