Created
May 9, 2024 15:15
-
-
Save dadecoza/57b4fe0a8252a888b06a89fe4a967c26 to your computer and use it in GitHub Desktop.
Arduino EEPROM Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Flashing LED indicates an error | |
#include <EEPROM.h> | |
unsigned char fillchar = 0xFF; | |
int fault = 0; | |
void setup() { | |
pinMode(13, OUTPUT); | |
// put your setup code here, to run once: | |
for (int i=0; i<1024; i++) { | |
EEPROM.write(i, fillchar); | |
} | |
for (int i=0; i<1024; i++) { | |
unsigned char b = EEPROM.read(i); | |
if (b != fillchar) { | |
fault = 1; | |
break; | |
} | |
} | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
if (fault) { | |
digitalWrite(13, HIGH); | |
delay(200); | |
digitalWrite(13, LOW); | |
delay(200); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment