Artemis EEPROM.write is Failing

The following code just stops on EEPROM.write(1, 2);

#include <EEPROM.h>

void setup() {

// Serial Output

Serial.begin(9600); // initialize serial communication

while (!Serial); // wait until it is working

Serial.println(“”);

Serial.println(“EEPROM Write Test”);

// for (int i = 0; i < 255; i++) {

// EEPROM.write(i, i);

// delay(100);

// }

EEPROM.write(1, 2);

Serial.println(“EEPROM Write Test Done”);

}

void loop() {

// put your main code here, to run repeatedly:

}

Artemis doesn’t have an EEPROM in it but I’ve been told that the latest board files emulate EEPROM in flash.

I think the way EEPROM works on the Artemis is a little bit different than how it works on Arduino, after you’ve updated to the latest board files, we have some example code under File/Examples in the IDE you might take a look at.

check the build-in example3_all functions around EEPROM. There is a bit more work to be done in order to use it.

TS-Chris:
Artemis doesn’t have an EEPROM in it but I’ve been told that the latest board files emulate EEPROM in flash.

I think the way EEPROM works on the Artemis is a little bit different than how it works on Arduino, after you’ve updated to the latest board files, we have some example code under File/Examples in the IDE you might take a look at.

Totally missed the EEPROM examples!

Some reference in the product materials would have been helpful.

Thanks

Also some documentation would have also helped.

Some reference in the product materials would have been helpful.

Yeah, I agree. Things change fast as we develop the platform so the documentation lags a bit.

Interestingly, this all came down to one line of code:

EEPROM.init();

Hope this helps someone!

#include <EEPROM.h>

void setup() {
    // Serial Output
  Serial.begin(9600); // initialize serial communication
  while (!Serial); // wait until it is working
  Serial.println("");
  EEPROM.init();
  Serial.println("EEPROM Read Test");
  for (int i = 0; i < 255; i++) {
    Serial.print(EEPROM.read(i));
    Serial.print(" ");
  }
  Serial.println("\nEEPROM Read Test Done");

  Serial.println("EEPROM Write Test");
  for (int i = 0; i < 255; i++) {
    EEPROM.write(i, i);
  }
  Serial.println("EEPROM Write Test Done");


}

void loop() {
  // put your main code here, to run repeatedly:

}