![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
rev 1.0
Revision 0:90ba5c73bcfb, committed 2014-07-09
- Comitter:
- APanecatl
- Date:
- Wed Jul 09 19:28:51 2014 +0000
- Commit message:
- FRDM-K64 Accelerometer-Magnetometer demo
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FXOS8700Q.lib Wed Jul 09 19:28:51 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/JimCarver/code/FXOS8700Q/#5553a64d0762
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jul 09 19:28:51 2014 +0000 @@ -0,0 +1,40 @@ +#include "mbed.h" +#include "FXOS8700Q.h" + +//I2C lines for FXOS8700Q accelerometer/magnetometer +FXOS8700Q_acc acc( PTE25, PTE24, FXOS8700CQ_SLAVE_ADDR1); +FXOS8700Q_mag mag( PTE25, PTE24, FXOS8700CQ_SLAVE_ADDR1); + +//Temrinal enable +Serial pc(USBTX, USBRX); + +MotionSensorDataUnits mag_data; +MotionSensorDataUnits acc_data; + + +int main() +{ + float faX, faY, faZ; + float fmX, fmY, fmZ; + + acc.enable(); + printf("\r\n\nFXOS8700Q Who Am I= %X\r\n", acc.whoAmI()); + + while (true) + { + acc.getAxis(acc_data); + mag.getAxis(mag_data); + printf("FXOS8700Q ACC: X=%1.4f Y=%1.4f Z=%1.4f ", acc_data.x, acc_data.y, acc_data.z); + printf(" MAG: X=%4.1f Y=%4.1f Z=%4.1f\r\n", mag_data.x, mag_data.y, mag_data.z); + acc.getX(&faX); + acc.getY(&faY); + acc.getZ(&faZ); + mag.getX(&fmX); + mag.getY(&fmY); + mag.getZ(&fmZ); + printf("FXOS8700Q ACC: X=%1.4f Y=%1.4f Z=%1.4f ", faX, faY, faZ); + printf(" MAG: X=%4.1f Y=%4.1f Z=%4.1f\r\n", fmX, fmY, fmZ); + + wait(1.0); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jul 09 19:28:51 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/024bf7f99721 \ No newline at end of file