Statistics
| Branch: | Revision:

root / arduino-1.0 / libraries / EEPROM / examples / eeprom_read / eeprom_read.ino @ 58d82c77

History | View | Annotate | Download (759 Bytes)

1
/*
2
 * EEPROM Read
3
 *
4
 * Reads the value of each byte of the EEPROM and prints it 
5
 * to the computer.
6
 * This example code is in the public domain.
7
 */
8

    
9
#include <EEPROM.h>
10

    
11
// start reading from the first byte (address 0) of the EEPROM
12
int address = 0;
13
byte value;
14

    
15
void setup()
16
{
17
  Serial.begin(9600);
18
}
19

    
20
void loop()
21
{
22
  // read a byte from the current address of the EEPROM
23
  value = EEPROM.read(address);
24
  
25
  Serial.print(address);
26
  Serial.print("\t");
27
  Serial.print(value, DEC);
28
  Serial.println();
29
  
30
  // advance to the next address of the EEPROM
31
  address = address + 1;
32
  
33
  // there are only 512 bytes of EEPROM, from 0 to 511, so if we're
34
  // on address 512, wrap around to address 0
35
  if (address == 512)
36
    address = 0;
37
    
38
  delay(500);
39
}