#include //I2C library byte i2c_eeprom_read_byte( int deviceaddress, unsigned int eeaddress ) { // function for reading one byte at given address byte rdata = 0xFF; Wire.beginTransmission(deviceaddress); Wire.write((int)(eeaddress >> 8)); // MSB Wire.write((int)(eeaddress & 0xFF)); // LSB Wire.endTransmission(); Wire.requestFrom(deviceaddress,1); if (Wire.available()) rdata = Wire.read(); return rdata; } void printHex(int num) { // function to convert DEC to HEX char tmp[16]; char format[128]; sprintf(format, "0x%%.%dX", 2); sprintf(tmp, format, num); Serial.print(tmp); } void setup() { Wire.begin(); // initialise the connection Serial.begin(9600); // set baud rate } void loop() { int StartAddr = 0; // address to start read from int EndAddr = 9; // address to end read at String OutputString = "Reading EEPROM memory from address "; OutputString = OutputString + StartAddr + " to " + EndAddr; Serial.println(OutputString); for (int addr = StartAddr; addr <= EndAddr; addr++) // memory begin and end address to read from { byte b = i2c_eeprom_read_byte(0x50, addr); // read from eeprom printHex(b); // print as HEX value Serial.print(" "); // values separator } Serial.print("\n"); delay(2000); // wait a bit before reading loop }