code with new accelerometers

Dependencies:   BLE_API i2c-serial-conflict nRF51822

Fork of accel_to_blenano_i2c by Nicholas Kosarek

Revision:
2:2082f0f50590
Parent:
1:e2ba28405dd5
Child:
3:3d08e2045bde
--- a/main.cpp	Mon Apr 10 02:19:13 2017 +0000
+++ b/main.cpp	Mon Apr 10 22:10:08 2017 +0000
@@ -203,6 +203,21 @@
     Wire.begin(SCL, SDA, TWI_FREQUENCY_100K);
     pc.printf("IIC Demo Start \r\n");
     
+    int nDevices = 0;
+    for (int i = 0; i < 128; i++) {
+        uint8_t i2caddr = (i << 1);
+        Wire.beginTransmission(i2caddr);
+        int error = Wire.endTransmission();
+        if(error == 0) {
+            pc.printf("I2C device found at 0x%x\n", i);
+            nDevices++;
+        }
+    }
+    if (nDevices == 0){
+        pc.printf("No I2C devices found\n");
+    } else
+        pc.printf("done\n");
+    
     uint8_t* whoami = new uint8_t[1];
     AT24C512_ReadBytes(REG_WHOAMI, whoami, 1, ADDR_ONE);
     pc.printf("Whoami: %d\r\n", whoami[1]);