Niranjan Ravi
/
FXOS8700Q_ACC_MAG_Display
Motion sensor program
Diff: main.cpp
- Revision:
- 2:a5a643b0eb25
- Parent:
- 1:bdfa2e80230f
--- a/main.cpp Wed Sep 18 00:29:49 2019 +0000 +++ b/main.cpp Wed Sep 18 00:38:49 2019 +0000 @@ -1,19 +1,15 @@ #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) { 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; - float gyro_data[3]; - pc.printf("FXAS21000 Gyro = %X\r\n", gyro.getWhoAmI()); acc.enable(); mag.enable(); while (true) { @@ -37,8 +33,6 @@ 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.2f Y:%6.2f Z:%6.2f\r\n", gyro_data[0], gyro_data[1], gyro_data[2]); wait(1.0f); } } \ No newline at end of file