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.
Dependencies: mbed MPU6050_template ledControl2 USBDevice
Revision 8:7b491d7b6d9d, committed 2020-10-21
- Comitter:
- remig
- Date:
- Wed Oct 21 08:22:49 2020 +0000
- Parent:
- 7:3e1e78b34e1a
- Child:
- 9:369106aa267a
- Commit message:
- NUCLEO STM32L476RG
Changed in this revision
--- a/MPU6050.lib Wed Aug 05 13:15:31 2015 +0000 +++ b/MPU6050.lib Wed Oct 21 08:22:49 2020 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/BaserK/code/MPU6050/#5b90f2b5e6d9 +https://developer.mbed.org/users/BaserK/code/MPU6050/#c5b827f8be2b
--- a/main.cpp Wed Aug 05 13:15:31 2015 +0000
+++ b/main.cpp Wed Oct 21 08:22:49 2020 +0000
@@ -57,13 +57,22 @@
#include "MPU6050.h"
#include "ledControl.h"
+//! Variable debug
+#define DEBUG
/* */
/* Defined in the MPU6050.cpp file */
// I2C i2c(p9,p10); // setup i2c (SDA,SCL)
+//! Instance pc de classe Serial
Serial pc(USBTX,USBRX); // default baud rate: 9600
+//! Instance mpu6050 de classe MPU6050
MPU6050 mpu6050; // class: MPU6050, object: mpu6050
+//! instance toggler1 de classe Ticker
+//! instance filer de classe Ticker
+// Ticker
+// A Ticker is used to call a function at a recurring interval.
+// You can use as many separate Ticker objects as you require.
Ticker toggler1;
Ticker filter;
@@ -92,15 +101,19 @@
/* Uncomment below if you want to see accel and gyro data */
-// pc.printf(" _____________________________________________________________ \r\n");
-// pc.printf("| Accelerometer(g) | ax=%.3f | ay=%.3f | az=%.3f \r\n",ax,ay,az);
-// pc.printf("| Gyroscope(deg/s) | gx=%.3f | gy=%.3f | gz=%.3f \r\n",gx,gy,gz);
-// pc.printf("|_____________________________________________________________ \r\n\r\n");
+ pc.printf(" _____________________________________________________________ \r\n");
+ pc.printf("| Accelerometer(g) | ax=%.3f | ay=%.3f | az=%.3f \r\n",ax,ay,az);
+ pc.printf("| Gyroscope(deg/s) | gx=%.3f | gy=%.3f | gz=%.3f \r\n",gx,gy,gz);
+ pc.printf("|_____________________________________________________________ \r\n\r\n");
//
-// wait(2.5);
+ wait(2.5);
- filter.attach(&compFilter, 0.005); // Call the complementaryFilter func. every 5 ms (200 Hz sampling period)
+ //filter.attach(&compFilter, 0.005); // Call the complementaryFilter func. every 5 ms (200 Hz sampling period)
+ #ifdef DEBUG
+ pc.printf(" [Debug On] \r\n");
+ mpu6050.complementaryFilter(&pitchAngle, &rollAngle);
+ #endif
pc.printf(" _______________\r\n");
pc.printf("| Pitch: %.3f \r\n",pitchAngle);
pc.printf("| Roll: %.3f \r\n",rollAngle);
--- a/mbed.bld Wed Aug 05 13:15:31 2015 +0000 +++ b/mbed.bld Wed Oct 21 08:22:49 2020 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/da0ca467f8b5 \ No newline at end of file +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file