// This example reads the byte value at address 28 in EEPROM // memory every second, and sends it over the serial line. // It then cyclically increments that value by one, and // writes it to the same address in EEPROM memory. // After removing the power from the i/o board, counting // picks up where it left off, because values stored in // EEPROM memory retain their value when power is lost. #include // import eeprom functions void setup() { Serial.begin(9600); // start serial communication Serial.println("Powerup"); // show when the program restarts } void loop() { byte b = EEPROM.read(28); // read byte value from eeprom address 28 Serial.println(b, DEC); // print that value via the serial port b = (b+1) % 256; // cyclically increment the value EEPROM.update(28, b); // write value to eeprom address 28 only if it changed delay(1000); // waste one second }