lol

Dependencies:   MMA8451Q

Fork of Application by Mateusz Kowalik

main.cpp

Committer:
danix
Date:
2018-01-21
Revision:
12:3a30cdffa27c
Parent:
11:b3f2a8bdac4d

File content as of revision 12:3a30cdffa27c:

#include "mbed.h"
#include "USBMouse.h"
#include "USBSerial.h"
#include "MMA8451Q.h"

DigitalOut  myled(LED1);
USBMouse mouse;
//USBSerial serial;
#define MMA8451_I2C_ADDRESS (0x1d<<1)
  
int main() {
    //USBSerial usbSerial;
MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
    float x, y, z;

    while (1) {
        x = (acc.getAccX()*10);
        y = (acc.getAccY()*10);
        z = (acc.getAccZ()*10);
        printf("X: %1.2f, Y: %1.2f, Z: %1.2f\n", x, y, z);
        mouse.move(x, y);
        wait(0.01);
    }
}