First some project info…
I’m building a small pressure data logger for my agricultural sprayer. It contains a Nano, pressure sensor, RTC clock, SD card, 16x2 LCD and one button.
Every second the pressure sensor is read, displayed on the LCD and stored in a 10 places array.
Every 10th second the average of the 10 last measurements are stored on the SD card including date and time. for that a made a 16 character String in the format “ddmm_hhmm:ss_p,p” . p,p means pressure from 0,0 between 9,9 bar. if the day or time is less than 10 an extra “0” is added, so I have always a 16 letter string. 360 lines for each hour of sprayer activity makes a (long) data list on my “datalog.txt” file. But a 32Gb card can easily store a year of work.
I use the SD.h library for access of the SD card
the code (for now) is in the attachment.
And then my question:
Now I want (with one push on the button) the last 360 lines (the last hour work) data one by one (for one second) back on my 16x2 LCD display. So I have to find the end of the file, and then go one line up at a time.
Do I need a different library with more functions?? Do I have to write the file upside down: the last log as first line instead of the last line??
I have no idea how to start with this, and can’t find a proper example on arduino.cc, youtube or google. This question is already solved somewhere by someone, I’m sure, but where can I find it?
drukregistratie5.ino (9.14 KB)