I tried to use Arduino SD Library, I was able to run Datalogger and Dumpfile sample application to verify that the bits and bytes are written perfectly in the SD card. When I tried to read from windows, everything is null. Is there an Arduino library that can write text file compatible to windows text format?
Notepad in Windows will show the raw data in a file - in all its hideous glory. However, there are things to make sure of:
Make sure that what you write to a file is ASCII characters. By that I mean do not simply write a byte or word value, convert it to a string first:
byte value; ...
value = Sensor.read(); // Return a value from 0-99 Card.write(value);
The above code will write a byte of
99 to the file - but you probably don't want that! The byte
32 is a space;
65 is the capital letter
97 is the lower case letter
a. Say what?
Every byte is represented by a different character in Notepad, so you need to convert the byte
97 into TWO bytes - first the byte (character)
9, and then the byte (character)
7. How do you do that?
One easy way is to use the following:
byte value; char buffer; // Define once for temporary use ... value = Sensor.read(); sprintf(buffer, " %d", value); // Store value in buffer as chars - with a leading space Card.write(buffer);
The above will write one (or more) characters into the file depending on the value you want to print. If your existing data was just a series of
0 bytes, your old code would have been nothing but NULLs. This will (at least) print
0 0 0 0 0 0 0 0 0 0