I2C master

Dependencies:   mbed

Revision:
0:33d0ef188319
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jul 24 03:27:30 2019 +0000
@@ -0,0 +1,25 @@
+#include "mbed.h"
+
+I2C i2c(I2C_SDA , I2C_SCL ); 
+
+const int addr8bit = 0xA0; // 8bit I2C address, 0x90
+
+char cmd[2];
+
+int main() 
+{
+    while(1)
+    {
+        cmd[0] = 'a';
+        cmd[1] = 'b';
+        i2c.write(addr8bit, cmd, 2);
+ 
+        wait(0.5);
+ 
+        #if 0
+        cmd[0] = 0x00;
+        i2c.write(addr8bit, cmd, 1);
+        i2c.read( addr8bit, cmd, 2);
+        #endif
+    }
+}
\ No newline at end of file