Thanks. I know this procedure but the problem is the "When finished read/write-ing" part. I think I was told to do the sampling as fast as possible so I guess I need to avoid the if-statement within the loop() function to test when, say a certain number of lines have been written or when a button/key is pressed. If I just unplug the card, I might corrup the file/file system or damage the sd card. Without using flush() to clear the buffer and then closing the file, the data file may not be written successfully.
Please refer to Post#31 and Post#47