Amanduino - Arduino's clone

Libraries‎ > ‎

EEEPROM

Summary

EEEPROM (External EEPROM) library supports external I2C EEPROMs.

Include

#include <EEEPROM.h>

Classes

EEEPROM(int address)

Support I2C EEPROM. Address is I2C memory address (settable using memory pins, read your EEPROM datasheet).

Methods

byte EEEPROM::read(unsigned int address)
Reads one byte from EEPROM.

Example #1
#include <Wire.h>
#include <EEEPROM.h>

// Define new external EEPROM
EEEPROM memory(0xBA);

void setup()
{
  // Start UART
  Serial.begin(9600);
  // Start I2C
  Wire.begin();
  
  // Read 14th byte
  byte v = memory.read(14);
  
  Serial.println(v, DEC);
}

void EEEPROM::write(unsigned int address, byte value)

Write byte to EEPROM.

Example #1
#include <Wire.h>
#include <EEEPROM.h>

// Define new external EEPROM
EEEPROM memory(0xBA);

void setup()
{
  // Start UART
  Serial.begin(9600);
  // Start I2C
  Wire.begin();
  
  // Write to 14th byte
  memory.write(14, 123);
  
  // 14th byte in 0xBA EEPROM is 123
}

void EEEPROM::readPage(unsigned int address, byte *data, int length)

Read page from EEPROM. Page size should be max. 30 bytes.

Example #1
#include <Wire.h>
#include <EEEPROM.h>

// Define new external EEPROM
EEEPROM memory(0xBA);

void setup()
{
  // Start UART
  Serial.begin(9600);
  // Start I2C
  Wire.begin();
  
  byte data[9];
  
  // Read data[] starting from 21st byte
  memory.readPage(21, data, 9);
}

Example #2
#include <Wire.h>
#include <EEEPROM.h>

// Define new external EEPROM
EEEPROM memory(0xBA);

void setup()
{
  // Start UART
  Serial.begin(9600);
  // Start I2C
  Wire.begin();
  
  byte *data;
  
  // Read 9 bytes of data starting from 21st byte
  memory.readPage(21, data, 9);
}

void EEEPROM::writePage(unsigned int address, byte *data, int length)

Write page to EEPROM. Page size should be max. 30 bytes.

Example #1
#include <Wire.h>
#include <EEEPROM.h>

// Define new external EEPROM
EEEPROM memory(0xBA);

void setup()
{
  // Start UART
  Serial.begin(9600);
  // Start I2C
  Wire.begin();
  
  byte data[] = {1, 1, 2, 3, 5, 8, 13, 21, 34};
  
  // Write data[] starting from 21st byte
  memory.writePage(21, data, 9);
}

Example #2
#include <Wire.h>
#include <EEEPROM.h>

// Define new external EEPROM
EEEPROM memory(0xBA);

void setup()
{
  // Start UART
  Serial.begin(9600);
  // Start I2C
  Wire.begin();
  
  byte data[] = {1, 1, 2, 3, 5, 8, 13, 21, 34};
  
  // Write data[] starting from 21st byte
  memory.writePage(21, data, sizeof(data));
}

Download

You can download the EEEPROM library from our Libraries repository.

Amanduino

Amanduino is a clone of popular Arduino platform. It has 30kB for user program, 2kB RAM and 1kB EEPROM, 14 digital input/output pins (1 UART, 6 PWM ports) and 6 analog inputs, built-in Real Time Clock. It's really small just 5.4x5.4 cm (2.1x2.1"). Amanduino is breadboard ready and Arduino shields compatible.

Twitter

Follow Amanduino on Twitter!

Pre-order

You can pre-order Your new Amanduino. Just $25 via Paypal. Starting production in July!

Libraries

Recent site activity

License