blue mbed code for the BNO055 imu from adafruit

Dependencies:   BNO055 MODSERIAL mbed

Fork of bmbed_lidar_belt by sensory_array

Revision:
2:ec53792aef80
Parent:
1:5b1d88d69aa2
Child:
3:a0ccaf565e8d
diff -r 5b1d88d69aa2 -r ec53792aef80 main.cpp
--- a/main.cpp	Thu Sep 24 18:08:53 2015 +0000
+++ b/main.cpp	Fri Sep 25 00:53:29 2015 +0000
@@ -78,7 +78,7 @@
                 }
             //write ---> 0 on success, 1 on failure
             i = 0;
-            while(sensor.read(addresses[k], receiveData, 3) || i < 10) {
+            while(sensor.read(addresses[k], receiveData, 3) && i < 10) {
                 i++;
                 //pc.printf("reading from sensor %d failed\n",k);
                 }
@@ -112,7 +112,7 @@
         char receiveData2[3] = {0};
         sensor.write(addresses[5], sendData, 1);
         i = 0;
-        while(sensor.read(addresses[5]+1, receiveData2, 3) || i < 10){
+        while(sensor.read(addresses[5]+1, receiveData2, 3) && i < 10){
             i++;}
         int distance2 = (receiveData2[0]<<8 )+ receiveData2[1];
         if(distance2 >= 500 && distance2 < 1000) {
@@ -125,8 +125,9 @@
 
         //find DOWN distance
         char receiveData3[3] = {0};
+        i = 0;
         sensor.write(addresses[6], sendData, 1);
-        while(sensor.read(addresses[6]+1, receiveData3, 3) || i < 10){
+        while(sensor.read(addresses[6]+1, receiveData3, 3) && i < 10){
             i++;}
         int distance3 = (receiveData3[0]<<8 )+ receiveData3[1];
         if(count > 400) {