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.
Revision 20:7e7325edcf5c, committed 2022-02-23
- Comitter:
- pmic
- Date:
- Wed Feb 23 07:17:16 2022 +0000
- Parent:
- 19:6c1a1c6faaf2
- Child:
- 21:9bda49bd381b
- Commit message:
- Included driver for LSM9DS1 IMU.
Changed in this revision
| PM2_Libary.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/PM2_Libary.lib Thu Feb 10 15:50:27 2022 +0000 +++ b/PM2_Libary.lib Wed Feb 23 07:17:16 2022 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/pmic/code/PM2_Libary/#76c40ecf8316 +https://os.mbed.com/users/pmic/code/PM2_Libary/#2542b22a84d2
--- 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 ----------------------------------------*/