Reading CSV files from a SD Card with An Arduino
Writing CSV files to an SD card is a fairly easy matter, build a string, adding a comma between each number and send that string to the ...
https://bethedev.blogspot.com/2017/01/reading-csv-files-from-sd-card-with.html
Writing CSV files to an SD card is a fairly easy matter, build a string, adding a comma between each number and send that string to the SD card. However, getting that data off the card and loaded back into use is not such an easy matter.
Here is a simple sketch that reads a CSV file with four numbers and two strings on each line. It doesn't use the dangerous String class.
gps.csv
Change the "gps.csv" file name according to your file name.
Arduino sd read CSV file.
If you have any questions please post your comments below.
Thank you!
Thank you! its works awesome
ReplyDeleteI have used the csv file to store latitudes and longitudes coming from adafruit gps. I want to use the data to make distance calculations. Can you please help me on how to get the last two entries in the csv file to make calculations. so that all the time i want to make a calculation i just need to get the last two entries of the cordinates.
ReplyDeleteSorry! I could not able to make at the time little work around. try to answer as possible. if you have any other question ! Thanks
DeleteThis comment has been removed by the author.
ReplyDeleteCould you explain how does the program read the line by line? Where is the line counter number?
ReplyDeleteThx David
Thanks for the example. I'm trying to do something similar, but with three strings. Would you be able to explain what these lines do? I am not sure about ptr and scr as well as the significance of * and &.
ReplyDeletechar line[200], *ptr, *str;
String a = strtok_r(ptr, ",", &str);
String first(str);
*loc = first;
String let(a);
*loc2 = let;