Step-by step introduction to I2C EEPROM

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
kaliczp
Date:
Wed Jan 13 09:29:03 2016 +0000
Parent:
2:41fccbb2e863
Commit message:
Write more address in a loop

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 41fccbb2e863 -r 58bd0878bb0f main.cpp
--- a/main.cpp	Tue Jan 12 22:18:21 2016 +0000
+++ b/main.cpp	Wed Jan 13 09:29:03 2016 +0000
@@ -22,8 +22,13 @@
     data_write[1] = 0;
     // Type data
     data_write[2] = 1;
-    i2c.write(EEPROM_ADDR, data_write, 3);
-    wait_ms(6); // Wait eeprom internal write cycle (5ms) + 1ms
+    uint8_t i;
+    for( i=0; i < 255; i++ ) {
+        data_write[1] = i;
+        data_write[2] = i;
+        i2c.write(EEPROM_ADDR, data_write, 3);
+        wait_ms(6); // Wait eeprom internal write cycle (5ms) + 1ms
+    }
     // Reset eeprom pointer address
     char eeprom_address[2] = {0, 0};
     i2c.write(EEPROM_ADDR, eeprom_address, 2, true);