![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
FRDM-K64 USB air mouse demo
Dependencies: FXOS8700Q USBDevice mbed
Diff: main.cpp
- Revision:
- 0:d50fb46005fd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jul 09 19:33:09 2014 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "USBMouse.h" +#include "FXOS8700Q.h" + +//I2C lines for FXOS8700Q accelerometer/magnetometer +FXOS8700Q_acc acc( PTE25, PTE24, FXOS8700CQ_SLAVE_ADDR1); + +USBMouse mouse; + +int main() +{ + acc.enable(); + float faX, faY, faZ; + int16_t x = 0; + int16_t y = 0; + + while (1) + { + //acc.getAxis(acc_data); + acc.getX(&faX); + acc.getY(&faY); + x = 10*faX; + y = 10*faY; + + mouse.move(x, y); + wait(0.001); + } +} \ No newline at end of file