I'm using Sparkfun's vernier shield and analogAutoID sketch, and trying to add the SD card datalog language. The problem is what to add at the Open SD part:
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
File dataFile = SD.open("datalog.txt", FILE_WRITE);
// if the file is available, write to it:
if (dataFile) {
dataFile.println( );
dataFile.close( );
// print to the serial port too:
Serial.println();
}
// if the file isn't open, pop up an error:
else {
Serial.println("error opening datalog.txt");
}
}
I can't figure out how to get it to compile. When I put "Channel" in the print.ln () and close () I get a "Channel wasn't declared in this scope". It's declared earlier in the sketch, though. The entire sketch I'm working on is attached.
analogAutoID_with_SD_attempt.ino (22.1 KB)