Scan I2C address with COM port output

Dependencies:   mbed

Revision:
0:02e1d738d7ad
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Dec 05 10:31:10 2015 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+
+I2C i2c(I2C_SDA, I2C_SCL);
+
+int addr = 0x00;
+
+int main()
+{
+    bool ack;
+    
+    printf("\nstart\n");
+
+    i2c.frequency(100000);
+
+
+    while(1) {
+        
+//sent data i2c     FIGURE 4-1
+        ack = i2c.write(addr,0x00,1);
+        wait_us(5);
+        
+        if(!ack) printf("I2C found @ %x\n",addr);
+        
+        if(addr>=0xFF) break;
+        addr++;
+    }
+    printf("stop\n\n");
+
+}
\ No newline at end of file