revision
Dependencies: MMA8451Q SLCD mbed
Fork of LCD_ACC_46_v4-2g by
Revision 6:16b55f8cde97, committed 2017-02-20
- Comitter:
- mturner5
- Date:
- Mon Feb 20 07:01:36 2017 +0000
- Parent:
- 5:e85646fe737e
- Commit message:
- revision 2
Changed in this revision
lcd_acc_46_v-2g.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r e85646fe737e -r 16b55f8cde97 lcd_acc_46_v-2g.cpp --- a/lcd_acc_46_v-2g.cpp Mon Feb 20 06:36:42 2017 +0000 +++ b/lcd_acc_46_v-2g.cpp Mon Feb 20 07:01:36 2017 +0000 @@ -143,22 +143,24 @@ while (dataTimer.read() > DATATIME){ //correct place? // No offset xAcc = abs(acc.getAccX()); - xcounts = acc.getAccAxis(REG_OUT_X_MSB); + xCounts = acc.getAccAxis(REG_OUT_X_MSB); yAcc = abs(acc.getAccY()); + yCounts = acc.getAccAxis(REG_OUT_Y_MSB); zAcc = abs(acc.getAccZ()); + zCounts = acc.getAccAxis(REG_OUT_z_MSB); // Calulate vector sum of x,y and z reading. 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 + vMAX = vector; } + + accaxisdata[XCOMPD] = abs((float)xCounts/COUNTSCALE); //why xCounts? x cord I think + accaxisdata[YCOMPD] = abs((float)yCounts/COUNTSCALE); + accaxisdata[zCOMPD] = abs((float)zCounts/COUNTSCALE); + accaxisdata[VMAXD] = vMax; dataTimer.reset(); + LEDDwell = 1.1 - vMax/MAXGS //don't unbderstand where this comes from } // Display the appropriate data on the LCD based upon what mode was chosen