Im trying to write a String into a file on a SDcard. Each time i write to it it starts on a new line, but i would like to be able to tell when I want a new line to make the data a little bit more readable. Tabs would be nice too.
\n does not work, but it does not show up in the file ider..
Post your code so we can see what you tried.
(preferably minimize the sketch that shows this behaviour)
Did you use the somefile.println(); statement? It places a newline in the file.
well, yes and no.
i collect alot of data during some seconds, then put it all with one write to the SDcard to save time(i guess?)
so i have something like this that i want to put into the .txt file and i want it to show the new lines.
with the somefile.println(); i will get a linefeed only after the howl row is inserted. when i check the textfile i cant see the \n in the file, so the textfile has recogniced them as commands atleast.
i have a computer with swedish on it, if that makes any difference? in old basic you could add a chr(50) to get a linefeed within a text.
I want to save everything to this file as there will be hundreds of datas read, and I feel that opening and closing the SD card that many times seems like a bad idea.
Newline for Windows is "\r\n" also know as CR/LF.
The Arduino println() function appends "\r\n" for newline.
Try changing your string like this:
Thank you ! \r\n solved my problem! my output file is now readable!