FRDM-K64 USB air mouse demo

Dependencies:   FXOS8700Q USBDevice mbed

Fork of FRDM-K64_USB by Augusto Panecatl

USB air mouse demo modified USB Analog Joystick with Low Power Mode Demo

main.cpp

Committer:
APanecatl
Date:
2014-07-09
Revision:
0:d50fb46005fd
Child:
1:b9ea91c4c533

File content as of revision 0:d50fb46005fd:

#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);
    }
}