Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. Code
  2.  
  3. /*
  4.  * EEPROM Read
  5.  *
  6.  * Reads the value of each byte of the EEPROM and prints it
  7.  * to the computer.
  8.  * This example code is in the public domain.
  9.  */
  10.  
  11. #include <EEPROM.h>
  12.  
  13. // start reading from the first byte (address 0) of the EEPROM
  14. int address = 0;
  15. byte value;
  16.  
  17. void setup()
  18. {
  19.   Serial.begin(9600);
  20. }
  21.  
  22. void loop()
  23. {
  24.   // read a byte from the current address of the EEPROM
  25.   value = EEPROM.read(address);
  26.  
  27.   Serial.print(address);
  28.   Serial.print("\t");
  29.   Serial.print(value, DEC);
  30.   Serial.println();
  31.  
  32.   // advance to the next address of the EEPROM
  33.   address = address + 1;
  34.  
  35.   // there are only 512 bytes of EEPROM, from 0 to 511, so if we're
  36.   // on address 512, wrap around to address 0
  37.   if (address == 512)
  38.     address = 0;
  39.    
  40.   delay(500);
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement