When I write '13' to the EEPROM and read it straight after it works correctly.
However when I comment out the write part of the code and try to just read the data, the value is no longer 13 as it used to be but reverts back to 255. Whats going on?
I am running a standalone atmega328 on a breadboard with a 16mhz crystal, programmed by a Nano R3.
void setup() {
Serial.begin(9600);
pinMode(2, OUTPUT);
//EEPROM.write(1,13);
}
void loop() {
scoreBinary();
}
void scoreBinary(){
int score= EEPROM.read(1);
if(score==13){
digitalWrite(2,HIGH);
}
delay(10000);
}