blue mbed code for the BNO055 imu from adafruit
Dependencies: BNO055 MODSERIAL mbed
Fork of bmbed_lidar_belt by
Diff: main.cpp
- Revision:
- 3:a0ccaf565e8d
- Parent:
- 2:ec53792aef80
- Child:
- 4:c53761262e3f
- Child:
- 7:660e8ddb231e
--- a/main.cpp Fri Sep 25 00:53:29 2015 +0000 +++ b/main.cpp Fri Sep 25 15:14:10 2015 +0000 @@ -105,7 +105,7 @@ pulses[k] = 1; intensity[k] = 0; } - pc.printf("num: %d \t pulses: %d \t intensity: %d \n",k,pulses[k],intensity[k]); + //pc.printf("num: %d \t pulses: %d \t intensity: %d \n",k,pulses[k],intensity[k]); } //find UP distance @@ -130,13 +130,14 @@ while(sensor.read(addresses[6]+1, receiveData3, 3) && i < 10){ i++;} int distance3 = (receiveData3[0]<<8 )+ receiveData3[1]; - if(count > 400) { + if(count > 200) { int difference = abs(down_cal - distance3); differenceAvgSum = differenceAvgSum - moving_ave[count2]; moving_ave[count2] = difference; differenceAvgSum = differenceAvgSum + difference; count2 = count2 + 1; int ave = (int)(differenceAvgSum/5); + //pc.printf("down_cal: %d \t diff: %d \t distance: %d\n",down_cal, ave, distance3); if(ave >= 160) { pulses[6] = 5; intensity[6] = 7; @@ -152,6 +153,7 @@ down_cal = distance3; count = count+1; } + //pc.printf("num: %d \t pulses: %d \t intensity: %d \n",6,pulses[6],intensity[6]); //pc.printf("about to send data\n"); btData[0] = (pulses[0] << 5) | (intensity[0] << 2); @@ -168,6 +170,7 @@ bt.putc(btData[j]); //wait(0.001); } + wait(0.05); //pc.printf("finished sending data\n"); //ble_uart_c_write_string(&m_ble_uart_c, (uint8_t *)btData, 9); }