how to write down the value of three input into a CSV file and storing them to the SD card in the form of a CVS file.?
thank you
Have you looked at the SD library examples, in particular the datalogger example ?
A look at the SD card documentation will augur you well.
Nevertheless, use this to create the .csv file.
File datafile=SD.open("file.csv",FILE_WRITE);
Implement this to store the values into the file.
File datafile=SD.open("file.csv",FILE_WRITE);
if(datafile)
{
String data=value_1+","+value_2+","+value_3;
datafile.println(data);
}
Voila !
String data=value_1+value_2+value_3;
No comma separators !
No comma separators !
Noted and corrected
Better yet, don't use the String
class. Just write the pieces:
File datafile=SD.open("file.csv",FILE_WRITE);
if(datafile) {
datafile.print( value_1 );
datafile.print( ',' );
datafile.print( value_2 );
datafile.print( ',' );
datafile.println( value_3 );
}
This saves about 1600 bytes of program space. And indent the code so everyone can read it easily.
Cheers,
/dev