Hi,
so basically i have an ecu with a 24c04 eeprom that i need to read, modify the contents and write.
i am new to the arduino world and c++ language (only started learning a few months ago).
i have found this sketch on this website (KN34PC - 24C04 Arduino library) that it seems it might work to read the eeprom but not to write the modified content.
What I need to change is this:
"In addresses 1EE to 1F9, write values 2A 4E 00 00 FF FF 00 9C D4 13 56 01"
i am trying to understand the code so that i can modify it to do want i want but i am not sure.
I would be gratfull if someone could help
thanks
#include<Wire.h>
void setup()
{
Serial.begin(9600);
Wire.beginTransmission(0x50);
Wire.write(0x01); //pointing high byte of EEPROM location: 01FE
Wire.write(0xFE); //lower byte of EEPROM location
Wire.write (0x2A); //data for location: 01EF
Wire.write(0x4E); //data for location 01EF
Wire.endTransmission();
delay(5); //write-time delay
//--read back and show on Serial Monitor
Wire.beginTransmission(0x50);
Wire.write(0x01); //higher byte og location
Wire.write(0xFE); //lower byte of location
Wire.endTransmission();
Wire.requestFrom(0x50, 2); //request to read 2 bytes
Serial.println(Wire.read(), HEX); //should show: 2A
Serial.println(Wire.read(), HEX); //should show: 4E
//--- if works, follow similar way to write other bytes.
//write next page of 8-byte
//write next two byte (partial paging is allowed).
}
void loop(){}