lundi 29 juin 2015

read commands from .txt sd in reverse order arduino

I'm wondering what the best method is to either reverse a text file from an SD card or read the command strings, last line to first line.

The strings will likely be lengthy so I don't want to create an array that will crash the arduino. Also, I want to avoid using .position and .seek methods because the commands are being stored in chunks of many lines and I feel logging/referencing all the unsigned long data would become too complex for me.

I would like to create a new text file that is a copy but in reverse order so I can read and execute a command one line at a time. If it is too difficult to do that, i will consider changing my code to integrate unsigned long time and pointers.

The text lines are of the form: "i, millis(), val, \r\n"

My code is very rough but any help or direction would be greatly appreciated, Thanks.

Aucun commentaire:

Enregistrer un commentaire