Test with FXOS8700CQ and LSM6DS3 in K64F
Dependencies: FXOS8700CQ LSM6DS3 mbed
Fork of I2C_LSM6DS3 by
Diff: main.cpp
- Revision:
- 1:83eb35fff8a9
- Parent:
- 0:ede57b616ea7
--- a/main.cpp Thu Apr 13 16:11:55 2017 +0000 +++ b/main.cpp Thu Jul 05 01:32:05 2018 +0000 @@ -1,29 +1,43 @@ #include "mbed.h" #include "LSM6DS3.h" +#include "FXOS8700CQ.h" -Serial pc(USBTX, USBRX); // tx, rx -LSM6DS3 LSM6DS3(p28,p27); +Serial pc(USBTX, USBRX, 115200); // tx, rx +LSM6DS3 LSM6DS3(PTE25,PTE24); +FXOS8700CQ fxos(PTE25,PTE24); +Data fxos_acc; +Timer t; +AnalogIn pot0(A0), pot1(A1), pot2(A2), pot3(A3); + +unsigned long int start_time = 0, end_time = 0; +uint16_t adc_value; int main() { - - LSM6DS3.begin(); +// LSM6DS3.begin(); +// fxos.init(); + t.start(); while(1) { + start_time = t.read_us(); //read Accel & Gyro + fxos_acc = fxos.get_values(); LSM6DS3.readAccel(); LSM6DS3.readGyro(); - - //serial send Accel + end_time = t.read_us(); + pc.printf("\nPass time: %d\n", end_time - start_time); + //serial send Accel (board) + pc.printf("BoardAccelerX[%f]\n",fxos_acc.ax); + pc.printf("BoardAccelerY[%f]\n",fxos_acc.ay); + pc.printf("BoardAccelerZ[%f]\n",fxos_acc.az); + //serial send Accel (lsm6ds33) pc.printf("AccelerX[%f]\n",LSM6DS3.ax); pc.printf("AccelerY[%f]\n",LSM6DS3.ay); pc.printf("AccelerZ[%f]\n",LSM6DS3.az); - //serial send Gyro pc.printf("GyroX[%f]\n",LSM6DS3.gx); pc.printf("GyroY[%f]\n",LSM6DS3.gy); pc.printf("GyroZ[%f]\n",LSM6DS3.gz); - + wait(3.0); } - } \ No newline at end of file