Play around with the xtrinsic sensors package available through Element14. Includes the MAG3110,MMA8491Q and MPL3115.

Dependencies:   MAG3110 MMA8491 MMA8491Q MPL3115 MPL3115A2 mbed

Files at this revision

API Documentation at this revision

Comitter:
seanburford
Date:
Thu Sep 14 06:53:53 2017 +0000
Child:
1:ecfba4d67833
Commit message:
Initial checkin

Changed in this revision

MAG3110.lib Show annotated file Show diff for this revision Revisions of this file
MMA8491.lib Show annotated file Show diff for this revision Revisions of this file
MMA8491Q.lib Show annotated file Show diff for this revision Revisions of this file
MPL3115.lib Show annotated file Show diff for this revision Revisions of this file
MPL3115A2.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MAG3110.lib	Thu Sep 14 06:53:53 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/NXP/code/MAG3110/#4194a41cfd16
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA8491.lib	Thu Sep 14 06:53:53 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/NXP/code/MMA8491/#ce9ae6fa9407
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA8491Q.lib	Thu Sep 14 06:53:53 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/jppang/code/MMA8491Q/#2d4b7fadb1e6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MPL3115.lib	Thu Sep 14 06:53:53 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/otis22894/code/MPL3115/#01659d3a8c37
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MPL3115A2.lib	Thu Sep 14 06:53:53 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/sophtware/code/MPL3115A2/#7c7c1ea6fc33
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Sep 14 06:53:53 2017 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+#include "MAG3110.h"
+#include "MMA8491.h"
+#include "MMA8491Q.h"
+#include "MPL3115.h"
+
+PwmOut rled(LED_RED);
+PwmOut gled(LED_GREEN);
+PwmOut bled(LED_BLUE);
+
+int main()
+{
+    MMA8491Q acc(PTE1, PTE0, MMA8491_I2C_ADDRESS);
+ 
+    while (true) {
+        rled = 1.0 - abs(acc.getAccX());
+        gled = 1.0 - abs(acc.getAccY());
+        bled = 1.0 - abs(acc.getAccZ());
+        wait(0.1);
+    }
+
+    //while (true) {
+    //    for (float i = 0.0f; i < 1.0f ; i += 0.001f) {
+    //        float p = 3 * i;
+    //        rled = 1.0f - ((p < 1.0f) ? 1.0f - p : (p > 2.0f) ? p - 2.0f : 0.0f);
+    //        gled = 1.0f - ((p < 1.0f) ? p : (p > 2.0f) ? 0.0f : 2.0f - p);
+    //        wait (0.0025f);
+    //    }
+    //}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Sep 14 06:53:53 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a330f0fddbec
\ No newline at end of file