first commit
Dependencies: PM2_Libary
Diff: main.cpp
- Revision:
- 20:7e7325edcf5c
- Parent:
- 17:c19b471f05cb
- Child:
- 22:f9370f71d17d
diff -r 6c1a1c6faaf2 -r 7e7325edcf5c main.cpp --- a/main.cpp Thu Feb 10 15:50:27 2022 +0000 +++ b/main.cpp Wed Feb 23 07:17:16 2022 +0000 @@ -72,8 +72,12 @@ float dist_us_sensor = 0.0f; +// LSM9DS1 IMU +// create imu comunication objects, carefull: not all PES boards have an imu (chip shortage) +LSM9DS1 imu(PC_9, PA_8); + int main() -{ +{ /* attach button fall and rise functions */ user_button.fall(&button_fall); user_button.rise(&button_rise); @@ -148,6 +152,7 @@ } /* do only output via serial what's really necessary (this makes your code slow)*/ + /* printf("%3.3f, %3d, %3.3f, %3.3f, %3d, %3d, %3.3f;\r\n", dist_ir_sensor * 1e3, encoder_M1.read(), @@ -156,7 +161,13 @@ servo_position_S1_mus, servo_position_S2_mus, dist_us_sensor); + */ + imu.updateGyro(); + imu.updateAcc(); + imu.updateMag(); + printf("%.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f\r\n", imu.readGyroX(), imu.readGyroY(), imu.readGyroZ(), + imu.readAccX(), imu.readAccY(), imu.readAccZ(), imu.readMagX(), imu.readMagY(), imu.readMagZ()); /* ------------- stop hacking ----------------------------------------*/