![](/media/cache/profiles/avatarGR_79eyiBn.png.50x50_q85.png)
V1
Dependencies: BSP_DISCO_L476VG COMPASS_DISCO_L476VG
main.cpp
- Committer:
- gr91
- Date:
- 2020-06-05
- Revision:
- 5:8f72ebf930bd
- Parent:
- 4:875e95338f6d
File content as of revision 5:8f72ebf930bd:
#include "mbed.h" #include "COMPASS_DISCO_L476VG.h" COMPASS_DISCO_L476VG compass; DigitalOut led1(LED1); int main() { int16_t AccBuffer[3]; printf("Compass started (LD5 should blink)\n"); while(1) { // Read acceleremoter compass.AccGetXYZ(AccBuffer); //printf("Acc X = %+06d\n", AccBuffer[0]); //printf("Acc Y = %+06d\n", AccBuffer[1]); //printf("Acc Z = %+06d\n", AccBuffer[2]); // //printf("Acc X = %+4.2f\n", AccBuffer[0]*0.061/1000); //printf("Acc Y = %+4.2f\n", AccBuffer[1]*0.061/1000); // printf("Acc Z = %+4.2f\n", AccBuffer[2]*0.061/1000); // //printf("\033[3A"); // Moves cursor up x lines (x value is between [ and A) printf("$%+4.2f %+4.2f %+4.2f;\n", AccBuffer[0]*0.061/1000,AccBuffer[1]*0.061/1000,AccBuffer[2]*0.061/1000); led1 = !led1; wait(0.1); } }