Well seen Miran Ligowyr !
Sorry, I'm guilty, I haven't properly done the modification.
I haven't neutralised the "Wire.write((int)(addr >>

);" piece of code and then I've done it for the readData subroutine but not for the "writeData" subroutine.
Here is the code and now it works great !
#include <Wire.h> // for I2C
#define i2caddr 0x50 // device address for left-hand chip on our breadboard
byte d=0; // data to store in or read from the EEPROM
void setup()
{
Serial.begin(9600); // Initialize the serial line
Wire.begin(); // wake up the I2C
Serial.println("Writing data...");
for (int i=0; i<20; i++)
{
writeData(i,i);
}
Serial.println("DONE");
Serial.println("Reading data...");
for (int i=0; i<20; i++)
{
Serial.print(i);
Serial.print(" : ");
d=readData(i);
Serial.println(d, DEC);
}
Serial.println("DONE");
}
// writes a byte of data in memory location addr
void writeData(unsigned int addr, byte data)
{
Wire.beginTransmission(i2caddr);
// set the pointer position
//Wire.write((int)(addr >> 8));
Wire.write((int)(addr & 0xFF));
Wire.write(data);
Wire.endTransmission(1);
delay(10);
}
// reads a byte of data from memory location addr
byte readData(unsigned int addr)
{
byte result;
Wire.beginTransmission(i2caddr);
// set the pointer position
//Wire.write((int)(addr >> 8));
Wire.write((int)(addr & 0xFF));
Wire.endTransmission(1);
Wire.requestFrom(i2caddr,1); // get the byte of data
result = Wire.read();
return result;
}
void loop()
{
}
To see what happen,for the 24C02, I replaced "for (int i=0; i<20; i++)" with
"for (int i=0; i<260; i++)
and I got
Writing data...
DONE
Reading data...
0 : 0
1 : 1
2 : 2
3 : 3
4 : 4
.
.
.
252 : 252
253 : 253
254 : 254
255 : 255
256 : 0
257 : 1
258 : 2
259 : 3
DONE
At #256 step, it seems to be rewriting on the #0 Byte ?
I'm playing with this ans I'll call you back later if needed.
Thanks so much for your help !