Final Project

Dependencies:   mbed-os FXAS21000 LED_Bar FXOS8700Q

Files at this revision

API Documentation at this revision

Comitter:
priyank12p
Date:
Fri Jan 15 22:11:19 2021 +0000
Child:
1:7a49fd0692fd
Commit message:
First Commit

Changed in this revision

FXAS21000.lib Show annotated file Show diff for this revision Revisions of this file
FXOS8700Q.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-os.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FXAS21000.lib	Fri Jan 15 22:11:19 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/JimCarver/code/FXAS21000/#a8f83b52f4df
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FXOS8700Q.lib	Fri Jan 15 22:11:19 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/carlosperate/code/FXOS8700Q/#a8deb4ce9b4a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jan 15 22:11:19 2021 +0000
@@ -0,0 +1,43 @@
+#include "mbed.h"
+#include "FXOS8700Q.h"
+#include "FXAS21000.h"
+    I2C i2c(PTE25, PTE24);
+    Serial pc(USBTX,USBRX);
+    FXOS8700QAccelerometer acc(i2c, FXOS8700CQ_SLAVE_ADDR1);    // Configured for the FRDM-K64F with onboard sensors
+    FXOS8700QMagnetometer mag(i2c, FXOS8700CQ_SLAVE_ADDR1);
+    FXAS21000 gyro(D14,D15);
+    int main(void)
+    {
+        float gyro_data[3];
+        motion_data_units_t acc_data, mag_data;
+        motion_data_counts_t acc_raw, mag_raw;
+        float faX, faY, faZ, fmX, fmY, fmZ, tmp_float;
+        int16_t raX, raY, raZ, rmX, rmY, rmZ, tmp_int;
+        acc.enable();
+        mag.enable();
+        while (true) {
+            // counts based results
+            acc.getAxis(acc_raw);
+            mag.getAxis(mag_raw);
+            acc.getX(raX);
+            acc.getY(raY);
+            acc.getZ(raZ);
+            mag.getX(rmX);
+            mag.getY(rmY);
+            mag.getZ(rmZ);
+            // unit based results
+            acc.getAxis(acc_data);
+            mag.getAxis(mag_data);
+            acc.getX(faX);
+            acc.getY(faY);
+            acc.getZ(faZ);
+            mag.getX(fmX);
+            mag.getY(fmY);
+            mag.getZ(fmZ);
+           pc.printf("FXOSQ8700Q ACC: X=%1.4fY=%1.4fZ=%1.4f", acc.getX(faX),acc.getY(faY),acc.getZ(faZ));
+           pc.printf("  MAG: X=%4.1fY=%4.1fZ=%4.1f\r\n", mag.getX(fmX),mag.getY(fmY), mag.getZ(fmZ));
+           gyro.ReadXYZ(gyro_data);
+           pc.printf("FXAS21000  Gyro: X=%6.2fY=%6.2fZ=%6.2f\r\n", gyro_data[0],gyro_data[1], gyro_data[2]);
+            wait(1.0f);
+        }
+    }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Fri Jan 15 22:11:19 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/priyank12p/code/mbed-os/#5df3065a10a9