Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <EEPROM.h>
- volatile byte e101 = LOW;
- volatile byte e102 = LOW;
- int error = 0;
- void setup() {
- pinMode(13, OUTPUT); // random line
- pinMode(12, INPUT); // random line
- for (int address = 0; address < 1; address++) {
- if (EEPROM.read(address) == 0xff) {
- EEPROM.write(address, LOW);
- } // no "else" here...
- if (EEPROM.read(address) != LOW) {
- error = 1;
- } else {
- error = 0;
- }
- }
- Serial.begin(9600);
- }
- void function1() {
- // do something
- // in case unexpected shit happens
- e101 == HIGH;
- EEPROM.update(0, e101);
- error = 1;
- }
- void function2() {
- // do something
- // some other unexpected action
- e102 == HIGH;
- EEPROM.update(1, e102);
- error = 1;
- }
- void loop () {
- if (error == 1) {
- // run the main loop
- } else {
- // do NOT run the main loop
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement