I was planning on building a current logging device with an Arduino, and tried starting off with the basic SD-card write example from the Arduino IDE sketchbook.
The Serial console showed no errors, so I assumed everything worked perfectly.
However... when I inserted the card in my computer (Ubuntu 18.04) and opened it with gedit, the file was blank? Vim had the same behaviour: it was blank.
But... when I used cat on the file, it DID show the contents?!
Anyone have a clue what I did wrong here?
EDIT: in reponse to Bodo's question:
output of cat:
... TEST TEST TEST TEST TEST TEST 372,345,324 342,340,330 331,332,328 327,325,324 322,320,318 317,315,313 313,310,309 ... (This is what's supposed to be in there)
out put of ls -l:
total 16 -rw-r--r-- 1 myname myname 15161 Jan 1 2000 DATALOG.TXT output of od -c -tx1 DATALOG.TXT | head -1 :
0000000 \r \n \r \n \r \n \r \n \r \n \r \n \r \n \r \n This last one answerd the question to me... It shows a bunch of newlines. But really... A LOT... This explains why gedit and vim showed empty files. I have to scroll down for ages before seeing the actual data. When using cat, I only saw the trailing lines, so it showed the contents. Probably something that went wrong when saving the data to the SD-card. Thanks Bodo! You solved my problem merely by posing a question :D
ls -l /location/of/your/sdcard. What doescat yourfileshow? Orod -c -tx1 yourfile | head -10?