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.
Fork of LSM9DS0 by
Diff: main.cpp
- Revision:
- 4:7ede465deae1
- Parent:
- 0:1b975a6ae539
- Child:
- 5:bf8f4e7c9905
--- a/main.cpp Tue Oct 21 18:33:41 2014 +0000
+++ b/main.cpp Sun Nov 23 17:46:45 2014 +0000
@@ -11,11 +11,14 @@
LSM9DS0 dof(p28, p27, LSM9DS0_G, LSM9DS0_XM);
DigitalIn DReady(p23);
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+
Serial pc(USBTX, USBRX); // tx, rx
-bool printMag = true;
-bool printAccel = true;
-bool printGyro = true;
+bool printM = true;
+bool printA = true;
+bool printG = true;
bool printHead = true;
void setup()
@@ -129,21 +132,21 @@
void loop() {
// Loop until the Data Ready signal goes high
- while (!Dready) {}
+ led2 = 1;
+ while (!DReady) {}
+ led2 = 0;
readData();
- if (printGyro) printGyro(); // Print "G: gx, gy, gz"
- if (printAccel) printAccel(); // Print "A: ax, ay, az"
- if (printMag) printMag(); // Print "M: mx, my, mz"
+ if (printG) printGyro(); // Print "G: gx, gy, gz"
+ if (printA) printAccel(); // Print "A: ax, ay, az"
+ if (printM) printMag(); // Print "M: mx, my, mz"
// Print the heading and orientation for fun!
if (printHead) printHeading((float) dof.mx, (float) dof.my);
//printOrientation(dof.calcAccel(dof.ax), dof.calcAccel(dof.ay),
// dof.calcAccel(dof.az));
pc.printf("\n");
-
- wait(2);
}
@@ -152,6 +155,8 @@
setup();
while (true)
{
+ led1 = !led1;
loop();
+ wait(2);
}
}
