SD Card single line data

Hi,
i m beginner for arduino.
i use Arduino Extended Database Library using an SD Card
i want store single data on sd card.
i try this library but if arduino reset, cannot read data.
i check if file exist not create file again.
only one time create file but reset device, and try read data in loop, dont read?

How can I fix it

Thanks.

The card uses the DOSFAT system where FAT is File Allocation Table.

You have to close the file for the DOS to update the FAT.

While working on the file, that information is kept in RAM but if power is lost then so are the links.

I always do sd card to keep a record of the information counter.
power failure or whether he reset the data record.
apart from that, we also need to keep in multiline records.
eprom memory write cycle will be shortages in the long run, both will remain as insufficient.
I keep two files in the SD card so.
first counter
The second log data
but yet I could not.

Thanks.

Write the line to the file then close the file. Close the file updates the FAT stored on the SD.

When you open the file again even after power off then on, your data should be there.

im connect CATALEX sd card "cs" pin to arduino nano A0 as digital 14. (other pins filled)

I think that's the problem? idea ?
sd.begin(14)->done. write like succes (file created and filled) , but not read (values null).

if this pin is a problem, i will change board layout.

EDIT: i try chance pin to 10. but not solved read problem.

Can you test just the SD? The code will be smaller and easier to isolate problems.

Whatever brand adapter I use, the library and SD code has all been the same.

Get used to the idea that the bug may not be what you think it is at all.

Post code that you ran (small example would be BEST) and tell what went wrong.
Be as exact as you can and leave out from that what you want to do or suspect.

If you open a file for write (it is read/write) then you should be able to use seek() to set the file pointer and read what you wrote even without closing the file. You still need to close the file before the data is fully on the SD.

open file for write
write to file
close file

open file again for read
read file
close file

Any write and then interruption before the close and you file is garbage.

Your IDE has an Up To Date version of the SD library that matches the IDE.

In the IDE File menu is Examples that lower down on that popdown list is SD and in the SD examples listed is ReadWrite.

Try that. Let's get the SD hardware cleared that way?

Also the SD card you use, it is formatted using an SD formatter program or how? It is SD not SDHC?
So many things to check.

@GoForSmoke
Thank for your Answers.
i found problem.
Extended database library sample not include line for "db.read(0)"

dbFile = SD.open("example.db", FILE_WRITE);
after;

  • db.read(0) then problem solved.

Thank you so much for sparing your time and interesting.