![](/media/cache/group/IMG_1289.JPG.50x50_q85.jpg)
Test program for FXOS8700CQ. Minimum functionality has been implemented, so far.
Dependencies: FXOS8700CQ mbed vt100
Diff: main.cpp
- Revision:
- 0:6a51e9fa41a0
- Child:
- 1:4bb4d99d4be5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Dec 25 05:43:12 2015 +0000 @@ -0,0 +1,33 @@ +#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) ; + } +}