Solution for Bluetooth SIG hands-on training course

Dependencies:   BLE_API mbed-dev-bin nRF51822-bluetooth-mdw

Dependents:   microbit

Fork of microbit-dal-bluetooth-mdw_starter by Martin Woolley

Revision:
6:2e1c2e0d8c7a
Parent:
1:8aa5cdb4ab67
Child:
37:b624ae5e94a5
--- a/source/drivers/MicroBitAccelerometer.cpp	Thu Apr 07 11:59:19 2016 +0100
+++ b/source/drivers/MicroBitAccelerometer.cpp	Thu Apr 07 23:39:31 2016 +0100
@@ -641,7 +641,8 @@
     float y = (float) getY(NORTH_EAST_DOWN);
     float z = (float) getZ(NORTH_EAST_DOWN);
 
-    roll = atan2(getY(NORTH_EAST_DOWN), getZ(NORTH_EAST_DOWN));
+    roll = atan2((double)getY(NORTH_EAST_DOWN), (double)getZ(NORTH_EAST_DOWN));
+
     pitch = atan(-x / (y*sin(roll) + z*cos(roll)));
     status |= MICROBIT_ACCEL_PITCH_ROLL_VALID;
 }
@@ -707,4 +708,4 @@
     {80000,     0x28},
     {160000,    0x30},
     {640000,    0x38}
-};
+};
\ No newline at end of file