Arduino Library for Atmel AT24Cx eeproms (Abstracts read() and write() )

Hello, newbie here :slight_smile:

While playing with an eeprom AT24C32 i've only found code that would allow us to write a byte or a page at a time. Since that made the code less readable i created a lib that abstracts both the Wire.h 32 byte buffer and the page size of the EPROM.

Now you can just code things like

Class Person {
  int age;
  int size;
}


Person p; 
Write(100, p); // 100 is the address you want to start writing to.

without having to calculate where you should write how many bytes to avoid page wraps and things like that.

This code was naturally inspired after reading other coders' code so thank you all :slight_smile:

The code can be found here: Atmel-AT24Cx Lib

Any suggestions? :slight_smile:

Thanks

Missing some test sketches to prove the lib works.

you might use these as example - Arduino/libraries/I2C_EEPROM at master · RobTillaart/Arduino · GitHub -

Hello.

thanks, you're right. It's much more handy with examples.

Just created a few. Do let me know what you find. i didn't use your examples, though.

It's one file with several independent test functions commented. You can uncomment and see them work. (Probably you'll also have to change the EEPROM address...)

Some tests fill the eeprom completely, others just write in two pages.

There's also an example of writing an object between to pages seamlessly :slight_smile:

Thanks for the tip.