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 Orientation_tracker X_NUCLEO_IKS01A2
Diff: main.cpp
- Revision:
- 22:bbdb7b928ccc
- Parent:
- 21:c62412a679b0
- Child:
- 23:9f1afcbd26f5
diff -r c62412a679b0 -r bbdb7b928ccc main.cpp
--- a/main.cpp Mon May 20 11:58:29 2019 +0000
+++ b/main.cpp Mon May 27 11:50:00 2019 +0000
@@ -40,7 +40,10 @@
#include "mbed.h"
#include "XNucleoIKS01A2.h"
#include "MadgwickAHRS.h"
-#define sampleFreqDef 2.0f
+#define sampleFreqDef 10.0f
+
+Serial pc(USBTX, USBRX, 115200);
+
/* Instantiate the expansion board */
static XNucleoIKS01A2 *mems_expansion_board = XNucleoIKS01A2::instance(D14, D15, D4, D5);
@@ -123,6 +126,7 @@
int32_t ac[3];
float gyrf[3];
float pitch, roll, yaw;
+ // pc.baud(115200);
/* Enable all sensors */
@@ -133,7 +137,7 @@
acc_gyro->enable_x();
acc_gyro->enable_g();
- printf("\r\n--- Starting new run ---\r\n");
+ //printf("\r\n--- Starting new run ---\r\n");
magnetometer->read_id(&id);
// printf("LSM303AGR magnetometer = 0x%X\r\n", id);
@@ -148,7 +152,7 @@
while(1) {
- printf("\r\n");
+ pc.printf("\r\n");
magnetometer->get_m_axes(axes);
mag[0] = axes[0];
@@ -188,8 +192,8 @@
// printf(" Roll: %.2f Pitch: %.2f , Yaw: %.2f\n\r", roll, pitch, yaw);
nmea = get_nmea_sentence(roll,pitch,yaw);
- printf("%s",nmea);
+ pc.printf("%s",nmea);
// printf("Hehehehe\n\r");
- wait(0.5);
+ wait(0.1);
}
}