revision
Dependencies: MMA8451Q SLCD mbed
Fork of LCD_ACC_46_v4-2g by
Diff: lcd_acc_46_v-2g.cpp
- Revision:
- 5:e85646fe737e
- Parent:
- 4:41920817d234
- Child:
- 6:16b55f8cde97
--- a/lcd_acc_46_v-2g.cpp Fri Feb 10 19:28:50 2017 +0000 +++ b/lcd_acc_46_v-2g.cpp Mon Feb 20 06:36:42 2017 +0000 @@ -140,16 +140,23 @@ } // -------------------------------------------- - while (dataTimer.read() > DATATIME){ + while (dataTimer.read() > DATATIME){ //correct place? // No offset xAcc = abs(acc.getAccX()); + xcounts = acc.getAccAxis(REG_OUT_X_MSB); yAcc = abs(acc.getAccY()); zAcc = abs(acc.getAccZ()); // Calulate vector sum of x,y and z reading. -// vector = sqrt(pow(xAcc,2) + pow(zAcc,2)); + vector = sqrt(pow(xAcc,2) + pow(zAcc,2)); vector = zAcc; if (vector > vMax) { + accaxisdata[XCOMPD] = (float)xCounts; //why xCounts? + accaxisdata[YCOMPD] = yAcc; + accaxisdata[zCOMPD] = zAcc; + accaxisdata[VMAXD] = vMax; vMax = vector; + dataTimer.reset(); + LEDDwell = 1.1 - vMax/MAXGS //don't unbderstand where this comes from } dataTimer.reset(); }