Format

EEPROMs contain special memory registers to keep data even if the microcontroller is unpowered. EEPROM size depends on the type of microcontroller you use. The ATmega328P contains 1024 bytes while the ATmega2560 contains 4096 bytes. In Ozeki the EEPROM is divided into blocks. Each block is identified by it's blockindex. You can always read or rewrite EEPROM registers.

Arduino microcontrollers, such as the Arduino Nano and Arduino Mega have a built in persistent storage called EEPROM. This storage is often filled with garbage, when you get a new arduino. The first thing you should do before you start to use your Arduino is to clear the EEPROM. The following code can be used to do this. It erases the EEPROM, and when it completes, it starts to blink the built in led. We recommend you to perform this 'Format' operation on all your arduino devices, before you start to use them with Ozeki.

Required hardware

  • Arduino Mega 2560
  • Arduino Nano
  • Arduino Uno
  • or any Ozeki Matrix Module

Source code to install on controller


#include <EEPROM.h>

int a;

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(115200);
  
  for (uint16_t i = 0; i < EEPROM.length(); ++i) {
    EEPROM.update(i, 0);
  }
  
  for (uint16_t i = 0; i < EEPROM.length(); ++i) {
    a+=EEPROM.read(i);
  }

  if (a == 0){
    Serial.println("EEPROM is null! The process was successfull!");
  } else if (a > 0) {
    Serial.println("EEPROM is not null, please upload the code again!");
  }
}

void loop() {
  if (a == 0){
    digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
    delay(1000);                       // wait for a second
    digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
    delay(1000);
  }
}

More information