blue mbed code for the BNO055 imu from adafruit

Dependencies:   BNO055 MODSERIAL mbed

Fork of bmbed_lidar_belt by sensory_array

Revision:
1:5b1d88d69aa2
Parent:
0:ce4f790399d9
Child:
2:ec53792aef80
--- a/main.cpp	Thu Sep 24 02:44:46 2015 +0000
+++ b/main.cpp	Thu Sep 24 18:08:53 2015 +0000
@@ -74,13 +74,14 @@
         for(int k=0; k<5; k++) {
             char receiveData[3] = {0};
             if(sensor.write(addresses[k], sendData, 1)){
-                pc.printf("writing to sensor %d failed\n", k);
+                //pc.printf("writing to sensor %d failed\n", k);
                 }
             //write ---> 0 on success, 1 on failure
             i = 0;
             while(sensor.read(addresses[k], receiveData, 3) || i < 10) {
                 i++;
-                pc.printf("reading from sensor %d failed\n",k);}
+                //pc.printf("reading from sensor %d failed\n",k);
+                }
                 //while(!twi_master_transfer(addresses[k], sendData, 1, TWI_ISSUE_STOP)){;}
                 //while(!twi_master_transfer(addresses[k] + 1, receiveData, 3, TWI_ISSUE_STOP)){;}
                 int distance = ((int)receiveData[0]<<8 )+ (int)receiveData[1];
@@ -110,7 +111,6 @@
         //find UP distance
         char receiveData2[3] = {0};
         sensor.write(addresses[5], sendData, 1);
-        wait(0.1);
         i = 0;
         while(sensor.read(addresses[5]+1, receiveData2, 3) || i < 10){
             i++;}
@@ -126,7 +126,6 @@
         //find DOWN distance
         char receiveData3[3] = {0};
         sensor.write(addresses[6], sendData, 1);
-        wait(0.1);
         while(sensor.read(addresses[6]+1, receiveData3, 3) || i < 10){
             i++;}
         int distance3 = (receiveData3[0]<<8 )+ receiveData3[1];
@@ -153,7 +152,7 @@
             count = count+1;
         }
 
-        pc.printf("about to send data\n");
+        //pc.printf("about to send data\n");
         btData[0] = (pulses[0] << 5) | (intensity[0] << 2);
         btData[1] = (pulses[1] << 4) | (intensity[1] << 1);
         btData[2] = (pulses[2] << 3) | (intensity[2]);
@@ -164,10 +163,11 @@
         btData[7] = (pulses[6] << 5) | (intensity[6] << 2);
         btData[8] = '\0';
         for(int j=0;j<9;j++){
-            bt.putc(btData[j]);
-            wait(0.01);
+            if(bt.writeable())
+                bt.putc(btData[j]);
+            //wait(0.001);
         }
-        pc.printf("finished sending data\n");
+        //pc.printf("finished sending data\n");
         //ble_uart_c_write_string(&m_ble_uart_c, (uint8_t *)btData, 9);
     }
 }