![](/media/cache/group/IMG_1289.JPG.50x50_q85.jpg)
Test program for FXOS8700CQ. Minimum functionality has been implemented, so far.
Dependencies: FXOS8700CQ mbed vt100
main.cpp
- Committer:
- Rhyme
- Date:
- 2015-12-25
- Revision:
- 0:6a51e9fa41a0
- Child:
- 1:4bb4d99d4be5
File content as of revision 0:6a51e9fa41a0:
#include "mbed.h" #include "vt100.h" #include "FXOS8700CQ.h" #include "MSS.h" /* * I2C address could be 0x1C, 0x1D, 0x1E, 0x1F * 0x1E (SA1 = 0, SA0 = 0) * 0x1D (SA1 = 0, SA0 = 1) * 0x1C (SA1 = 1, SA0 = 0) * 0x1F (SA1 = 1, SA1 = 1) */ #define FXOS8700CQ_I2C_ADDRESS (0x1E) vt100 *tty = 0 ; FXOS8700CQ *fxos = 0 ; int main() { int16_t accData[3], mgnData[3] ; tty = new vt100() ; tty->cls() ; fxos = new FXOS8700CQ(PIN_SDA, PIN_SCL, FXOS8700CQ_I2C_ADDRESS) ; fxos->init() ; while(1) { fxos->readAccMgnData(accData, mgnData) ; printf("ACC X[%d], Y[%d], Z[%d], MGN X[%d], Y[%d], Z[%d]\n", accData[0], accData[1], accData[2], mgnData[0], mgnData[1], mgnData[2]) ; wait(0.2) ; } }