Rune Langoy / Mbed 2 deprecated I2C_detect_address

Dependencies:   mbed

Fork of LAB11_Oppgave1 by EL-POM1001

Files at this revision

API Documentation at this revision

Comitter:
rlanghbv
Date:
Mon Nov 09 13:39:59 2015 +0000
Child:
1:2d9d32fc4f5d
Commit message:
First Commit

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Nov 09 13:39:59 2015 +0000
@@ -0,0 +1,17 @@
+#include "mbed.h"
+  
+         //SDA , SCL
+I2C i2cBus(PB_9, PB_8);
+ 
+int main()
+{
+        i2cBus.frequency(100000);
+                        
+        //Scan the valid I2C addresrange: 0x3 to 0x77
+        for (int i2cAddres=3; i2cAddres<=0x77; i2cAddres++) {
+            if (!i2cBus.write(i2cAddres<<1, NULL, 0)) {   // 0 if  a device ACK'ed the message
+                printf("\r\nI2C device found at address 0x%02X                 \r\n", i2cAddres);
+            }
+        }
+}
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Nov 09 13:39:59 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11
\ No newline at end of file