As you know, traditional EEPROM does not work on feather, so I found the EEPROM.begin(512) command on some documentation.
The function worked well as long as the rest of the sketch was empty.
However this is a Feather with DVI. As I added the video code to the board I got in trouble.
It all looks great until I write to eeprom. Then the screen goes blank.
If I re-boot it is still blank. No video. However I can read the EEPROM and see it on serial monitor.
I need to re-upload the whole sketch. And then I can't write anything.
Here is the code
#include <EEPROM.h>
// the current address in the EEPROM (i.e. which byte
// we're going to write to next)
int addr = 0;
unsigned long PrintTimer = 0;
int FromEnc;
int valueBack;
void setup() {
Serial.begin(115200);
EEPROM.begin(512);
}
void loop() {
// need to divide by 4 because analog inputs range from
// 0 to 1023 and each byte of the EEPROM can only hold a
// value from 0 to 255.
int val = 155;// analogRead(A0) / 4;
// write the value to the appropriate byte of the EEPROM.
// these values will remain there when the board is
// turned off.
EEPROM.put(addr, 86400);
// advance to the next address. there are 512 bytes in
// the EEPROM, so go back to 0 when we hit 512.
// save all changes to the flash.
addr = addr + 1;
if (addr == 512) {
addr = 0;
if (EEPROM.commit()) {
//Serial.println("EEPROM successfully committed");
} else {
//Serial.println("ERROR! EEPROM commit failed");
}
}
if (millis() - PrintTimer >= 1000)
{ PrintTimer = millis();
//Get the float data from the EEPROM at position 'eeAddress'
EEPROM.get(addr, valueBack);
Serial.println( valueBack ); //This may print 'ovf, nan' if the data inside the EEPROM is not a valid float.
}
// delay(100);
}