dhiltonp

eeprom test read

Jan 2nd, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  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.   Serial.print("checksum: ");
  23.   Serial.println(check_eeprom());
  24.    
  25.   delay(500);
  26. }
  27.  
  28. int check_eeprom() {
  29.   int checksum = 0;
  30.   for(int i=0; i<512;i++) {
  31.     value = EEPROM.read(address);
  32.     checksum+=value;
  33.   }
  34.   return checksum;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment