How to read values from SD card txt into an array
hi
i need project:
i want read values txt file on sd card , store them in array.
the code reading values read seems cannot set array without knowing lenght/size. run code twice first count entries in txt , setting array counted size.
but need declare array in code before size declare it.
i output on lcd telling me values , counter position while reading txt , try store values using counter index
myarray[counter] = valuefromtxt;
but in end array remains empty.
any idea?
please, not advanced coder - please keep simple
thanks lot!
i need project:
i want read values txt file on sd card , store them in array.
the code reading values read seems cannot set array without knowing lenght/size. run code twice first count entries in txt , setting array counted size.
but need declare array in code before size declare it.
i output on lcd telling me values , counter position while reading txt , try store values using counter index
myarray[counter] = valuefromtxt;
but in end array remains empty.
any idea?
please, not advanced coder - please keep simple

thanks lot!
the easiest thing declare array maximum expected number of elements. after all, if there number of entries in file if expand array or declare dynamically accommodate them, number of elements required.
when reading file should ensure number of entries put array not exceed number of elements in array.
as current solution, impossible sure without seeing code, how , declare array , have taken scope account ?
please post code.
when reading file should ensure number of entries put array not exceed number of elements in array.
as current solution, impossible sure without seeing code, how , declare array , have taken scope account ?
please post code.
Arduino Forum > Using Arduino > Programming Questions > How to read values from SD card txt into an array
arduino
Comments
Post a Comment