jwhiddon / EDB

A re-implementation of the Arduino database library to allow more than 256 records
GNU Lesser General Public License v2.1
89 stars 43 forks source link

How do use with SD card? #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. How do you use this with and SD card?
2. You can change the position in the SD file by the position but that does not 
read or write.
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by bruce.ve...@gmail.com on 30 Dec 2013 at 9:39

GoogleCodeExporter commented 8 years ago
Basically you have to create a file 
e.g. dbFile = SD.open("example.db", FILE_WRITE);
and then you can use the seek methods of the file library in the reader/writer 
classes

void writer(unsigned long address, byte data)
{
  dbFile.seek(address);
  dbFile.write(data);
  dbFile.flush();
}

byte reader(unsigned long address)
{
  dbFile.seek(address);
  return dbFile.read();
}

Fulle example see 
http://blog.brauingenieur.de/2014/01/20/extended-database-library-using-an-sd-ca
rd

Original comment by martin.n...@gmail.com on 29 Jan 2014 at 8:23

joscha commented 8 years ago

https://github.com/firebull/arduino-edb/blob/master/examples/EDB_SDCARD/EDB_SDCARD.pde might help.