Arduino SD Card Read

I got a library for the SD Card for the Arduino :

From the examples folder, I used the program SDCard Read... This program prints the text from the SDCard .txt file to the Serial Port. However I want to store those numbers into an array of type int so that I can access them whenever I want. How do I do this?

The .txt file that I want to read is: 60 70 68 90

It is always going to be 8 2-digit numbers...

The function reads the specified number of bytes (or less) from the file. The for loop prints them to the Serial Monitor. You can copy them to other arrays, if you want.

If the program currently shows 10 20 30 etc. Then there are distinct end of record markers present. You could change the for loop to print the characters in different ways (DEC, BYTE, HEX, etc.) to see what the end of record markers actually are. Then copy characters up to the end of record marker to another character array. When the end-of-record marker is seen, convert the array to an integer, and store that in an integer array.

Ill try that… but it does not seem to be an EOF character…

Hey Paul... I figured it out. Seems that there was a character that was extra apart from the numbers from the SD Card. After every number from the SD Card, it displayed "1310". So I read all values and store into an integer array except when I read "1310" value.

Thanks for hinting me in the right direction!

10 is a line feed. 13 is a carriage return.

FYI The 13 10 characters are the Carriage Return and Line Feed. CR = 13, LF = 10. Different platforms (eg unix windows) and different applications may use different line endings in textfiles. All variations occur in real life CRLF, CR, LF, LFCR, although the latter occurs less.

check for more special characters. Note this table and its special characters were defined in the terminal era before the PC. More history see

Oh... Ill remember that... Thanks for the links! They are really helpful!

Oh... Ill remember that...

Please don't try to. If you need to compare a value to see if it is some particular ascii value, use it's ascii equivalent. There is no reason to do this:

if(byte == 0x30)

when you are checking to see if the byte is the digit 0. Use this:

if(byte == '0')

You can check for the carriage return using '\r' and the line feed using '\n'.

Oh okay I'll do that... Thanks!