hi, I'm pretty new to the arduino language and the current program I'm working on doesnt make much sense to me. First of all heres the code(mostly copied from other people):
//Add the SdFat Libraries
//Create the variables to be used by SdFat Library
char name = "10.txt"; //Create an array that contains the name of our file.
char contents; //This will be a data buffer for writing contents to the file.
int index=0; //Index will keep track of our position within the contents buffer.
Serial.begin(9600); //Start a serial connection.
pinMode(10, OUTPUT); //Pin 10 must be set as an output for the SD communication to work.
card.init(); //Initialize the SD card and configure the I/O pins.
volume.init(card); //Initialize a volume on the SD card.
root.openRoot(volume); //Open the root directory in the volume.
temp = (1.8663 - (5.0 * analogRead(A5) / 1024.0)) / 0.01169;
file.open(root, name, O_CREAT | O_APPEND | O_WRITE); //Open or create the file 'name' in 'root' for writing to the end of the file.
sprintf(contents, "Temp:,%0d", temp);
file.print(contents); //Write the 'contents' array to the end of the file.
file.close(); //Close the file.
Basically I'm reading a temp. sensor and (if I understand properly) sending the data to a buffer and then to my sd card with the help of the sdFat library. So the problem is that I want a carraige return after each reading but I dont know how to accomplish that. Currently when I read off the card I get this: Temp:,24Temp:,25Temp:,24 but i want to get:
Do any of you know how to do this?