Code Monkey home page Code Monkey logo

at24cx's Introduction

AT24CX Library

Library for using the Atmels EEPROM AT24C32/AT24C64/AT24C128/AT24C256/AT24C512 in Arduino projects. See https://oberguru.net/elektronik/eeprom/at24cx-at24c32-at24c64-at24c128-at24c256-at24c512.html for definitons and differences.

Written by Christian Paul, 2014 - 2015. This software is released under the terms of the MIT license. See the file LICENSE or LIZENZ for details, please.

You can use any of the eight possibles EEPROM devices on the I2C bus.

Constructor

AT24CX(byte pageSize);

uses the device with index 0 and given page size. You can select a device with given index between 0 and 8 with constructor

AT24CX(byte index, byte pageSize);

Than, you can single write or read single bytes from the EEPROM with

void write(unsigned int address, byte data);
byte read(unsigned int address);

or write and read an array of bytes with

void write(unsigned int address, byte *data, int n);
void read(unsigned int address, byte *data, int n);

For writing integers, long, float, double or sequences of chars you can use the comfort functions

void writeInt(unsigned int address, unsigned int data);
void writeLong(unsigned int address, unsigned long data);
void writeFloat(unsigned int address, float data);
void writeDouble(unsigned int address, double data);
void writeChars(unsigned int address, char *data, int length);

Reading the values is done by using

unsigned int readInt(unsigned int address);
unsigned long readLong(unsigned int address);
float readFloat(unsigned int address);
double readDouble(unsigned int address);
void readChars(unsigned int address, char *data, int n);

Alternative you can use the individual classes with predefined page sizes:

AT24C32();
AT24C64();
AT24C128();
AT24C256();
AT24C512();

or with different index than 0:

AT24C32(byte index);
AT24C64(byte index);
AT24C128(byte index);
AT24C256(byte index);
AT24C512(byte index);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.