V1
Dependencies: BSP_DISCO_L476VG COMPASS_DISCO_L476VG
Revision 5:8f72ebf930bd, committed 2020-06-05
- Comitter:
- gr91
- Date:
- Fri Jun 05 10:59:45 2020 +0000
- Parent:
- 4:875e95338f6d
- Commit message:
- V1
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 875e95338f6d -r 8f72ebf930bd main.cpp --- a/main.cpp Tue Sep 24 18:05:30 2019 +0200 +++ b/main.cpp Fri Jun 05 10:59:45 2020 +0000 @@ -7,26 +7,22 @@ int main() { - int16_t MagBuffer[3]; int16_t AccBuffer[3]; - printf("Compass started (LD5 should blink)\n"); - while(1) { - - // Read acceleremoter and magnetometer values + // Read acceleremoter compass.AccGetXYZ(AccBuffer); - compass.MagGetXYZ(MagBuffer); - // Display values - printf("Acc X = %d\n", AccBuffer[0]); - printf("Acc Y = %d\n", AccBuffer[1]); - printf("Acc Z = %d\n", AccBuffer[2]); - printf("Mag X = %d\n", MagBuffer[0]); - printf("Mag Y = %d\n", MagBuffer[1]); - printf("Mag Z = %d\n", MagBuffer[2]); - printf("\033[6A"); // Moves cursor up x lines (x value is between [ and A) - + //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; - ThisThread::sleep_for(1000); + wait(0.1); } }