this is program how build nRF51822 to get ADXL345 data
Dependencies: BLE_API mbed nRF51822
Fork of ADXL345_I2C by
Diff: main.cpp
- Revision:
- 14:afe556cc0a6c
- Parent:
- 13:e5327d2de406
- Child:
- 15:a24cfc193284
--- a/main.cpp Sat Dec 09 06:44:56 2017 +0000 +++ b/main.cpp Tue Dec 12 15:48:28 2017 +0000 @@ -67,10 +67,10 @@ { accelerometer.getOutput(readings); xval[i]=(readings[0]); //nilai x adxl345 - sum1 = yval[i]+sum1; + sum1 = xval[i]+sum1; } - xavg=sum1/10.0; + xavg=sum1/10; led1=0; return xavg; @@ -211,8 +211,8 @@ uart1.printf("\n%i, %i, %i\n", (int16_t)avg1, (int16_t)avg2, (int16_t)avg3); /* memset(&buffer, 0, sizeof(buffer)); snprintf(buffer, 20, "data: %d,%d,%d\n\n", (int16_t)avg1,(int16_t)avg2,(int16_t)avg3); - ble.updateCharacteristicValue(uartServicePtr->getRXCharacteristicHandle(), (uint8_t*)buffer, sizeof(buffer), false);*/ - wait(0.1); + ble.updateCharacteristicValue(uartServicePtr->getRXCharacteristicHandle(), (uint8_t*)buffer, sizeof(buffer), false); + wait(0.1);*/