Nora Vazbyte
/
99Problems-BLEAint1
app critics will say it's money, cash, toes
Diff: source/main.cpp
- Revision:
- 8:1735fddd5491
- Parent:
- 7:9e2172e6550a
- Child:
- 9:40874a5c5ad0
--- a/source/main.cpp Sun Nov 04 18:24:36 2018 +0000 +++ b/source/main.cpp Mon Nov 05 16:08:00 2018 +0000 @@ -30,7 +30,8 @@ int16_t destination[3]; //uint8_t hrmCounter = 0; -double hrmCounter = 0; +short hrmCounter = 0; +short test_var = 0; static HeartRateService* hrService; MPU9250 mpu = MPU9250(P0_26, P0_27); @@ -43,25 +44,31 @@ void updateSensorValue() { mpu.readAccelData(destination); +// test_var++; - double acc_x = destination[0] / 10.0; - double acc_y = destination[1] / 10.0; - double acc_z = destination[2] / 10.0; + double acc_x = destination[0] / 1000.0; + double acc_y = destination[1] / 1000.0; + double acc_z = destination[2] / 1000.0; +// printf("acc_x: " ); +// printf("%f\n", acc_x); 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); +// printf("sqr_acc_x: " ); +// printf("%f\n", sqr_acc_x); double sum_acc = sqr_acc_x + sqr_acc_y + sqr_acc_z; printf("sum_acc: " ); printf("%f\n", sum_acc); double value = sqrt(sum_acc); - hrmCounter = acc_x; - printf("value: " ); - printf("%d\n", value); + hrmCounter = (short) value; +// hrmCounter = test_var; + printf("SEND_VALUE: " ); + printf("%hu\n", hrmCounter); +// printf("value: " ); +// printf("%f\n", value); /* printf("%u\n", (unsigned int)acc_x);*/ hrService->updateHeartRate(hrmCounter);