Step-by step introduction to I2C EEPROM

Dependencies:   mbed

Revision:
0:f7bdc8dfa76d
Child:
1:c1f476b94bb3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jan 12 05:35:20 2016 +0000
@@ -0,0 +1,19 @@
+/***
+**** ST M24512 512-Kbit I2C EEPROM
+**** E0-E2 pulled low
+**** 10k pull up resistors on SDA and SCL lines
+***/
+#include "mbed.h"
+
+#define EEPROM_ADDR   (0b10100000) // EEPROM address
+
+I2C i2c(I2C_SDA, I2C_SCL);
+
+int main()
+{
+    char data[1];
+    i2c.read(EEPROM_ADDR, data, 1);
+    while (1) {
+    }
+
+}
\ No newline at end of file