2007-05-04 23:53:23 +02:00
|
|
|
/*
|
|
|
|
* EEPROM Read
|
|
|
|
*
|
2013-10-21 09:58:40 +02:00
|
|
|
* Reads the value of each byte of the EEPROM and prints it
|
2007-05-04 23:53:23 +02:00
|
|
|
* to the computer.
|
2010-02-24 04:49:48 +01:00
|
|
|
* This example code is in the public domain.
|
2007-05-04 23:53:23 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <EEPROM.h>
|
|
|
|
|
|
|
|
// start reading from the first byte (address 0) of the EEPROM
|
|
|
|
int address = 0;
|
|
|
|
byte value;
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
2012-04-11 12:56:31 +02:00
|
|
|
// initialize serial and wait for port to open:
|
2007-05-04 23:53:23 +02:00
|
|
|
Serial.begin(9600);
|
2012-04-11 12:56:31 +02:00
|
|
|
while (!Serial) {
|
|
|
|
; // wait for serial port to connect. Needed for Leonardo only
|
|
|
|
}
|
2007-05-04 23:53:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
// read a byte from the current address of the EEPROM
|
|
|
|
value = EEPROM.read(address);
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2007-05-04 23:53:23 +02:00
|
|
|
Serial.print(address);
|
|
|
|
Serial.print("\t");
|
|
|
|
Serial.print(value, DEC);
|
|
|
|
Serial.println();
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2007-05-04 23:53:23 +02:00
|
|
|
// advance to the next address of the EEPROM
|
|
|
|
address = address + 1;
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2007-05-04 23:53:23 +02:00
|
|
|
// there are only 512 bytes of EEPROM, from 0 to 511, so if we're
|
|
|
|
// on address 512, wrap around to address 0
|
|
|
|
if (address == 512)
|
|
|
|
address = 0;
|
2013-10-21 09:58:40 +02:00
|
|
|
|
2007-05-04 23:53:23 +02:00
|
|
|
delay(500);
|
|
|
|
}
|