Nora Vazbyte
/
99Problems-BLEAint1
app critics will say it's money, cash, toes
Diff: source/main.cpp
- Revision:
- 7:9e2172e6550a
- Parent:
- 6:887df9bbe705
- Child:
- 8:1735fddd5491
--- a/source/main.cpp Tue Oct 30 17:20:10 2018 +0000 +++ b/source/main.cpp Sun Nov 04 18:24:36 2018 +0000 @@ -30,9 +30,8 @@ int16_t destination[3]; //uint8_t hrmCounter = 0; -int16_t hrmCounter = 0; +double hrmCounter = 0; static HeartRateService* hrService; -//MPU9250 mpu = MPU9250(p26, p27); MPU9250 mpu = MPU9250(P0_26, P0_27); static EventQueue eventQueue(/* event count */ 16 * EVENTS_EVENT_SIZE); @@ -45,13 +44,13 @@ void updateSensorValue() { mpu.readAccelData(destination); - int16_t acc_x = destination[0] / 1000.0; - int16_t acc_y = destination[1] / 1000.0; - int16_t acc_z = destination[2] / 1000.0; + double acc_x = destination[0] / 10.0; + double acc_y = destination[1] / 10.0; + double acc_z = destination[2] / 10.0; - int16_t sqr_acc_x = acc_x*acc_x; - int16_t sqr_acc_y = acc_y*acc_y; - int16_t sqr_acc_z = acc_z*acc_z; + double sqr_acc_x = acc_x*acc_x; + double sqr_acc_y = acc_y*acc_y; + double sqr_acc_z = acc_z*acc_z; printf("sqr_acc_x: " ); printf("%d\n", sqr_acc_x); @@ -59,7 +58,7 @@ printf("sum_acc: " ); printf("%f\n", sum_acc); - int16_t value = sqrt(sum_acc); + double value = sqrt(sum_acc); hrmCounter = acc_x; printf("value: " ); printf("%d\n", value);