Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 20:7e7325edcf5c
- Parent:
- 17:c19b471f05cb
- Child:
- 22:f9370f71d17d
--- 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 ----------------------------------------*/