EEPROM:M24C02 class driver and operation sample code for Arduino
What is this?
EEPROM:M24C02 interface to write/read data with simple interface.
void setup() {
while (!Serial)
;
Wire.begin();
Serial.println("\n***** Hello, M24C02! *****");
}
void loop() {
constexpr static char test_str0[] = "Hello, M24C02! This is test code for M24C02 class driver. Trying to write and read.";
static char s[ 128 ];
eeprom.
write(0, (uint8_t *)test_str0,
sizeof(test_str0));
Serial.print("written into EEPROM :");
Serial.println(test_str0);
eeprom.
read(0, (uint8_t *)s,
sizeof(test_str0));
Serial.print("read back from EEPROM :");
Serial.println(s);
delay(1000);
}
uint8_t read(int byte_adr)
int write(int byte_adr, uint8_t data)