Plot of accelerometers axis

Dependencies:   MMA8451Q mbed

main.cpp

Committer:
sarthakgadre
Date:
2016-12-03
Revision:
0:a0321e9eb2d8

File content as of revision 0:a0321e9eb2d8:

#include "mbed.h"

#include"MMA8451Q.h"
#define MMA8451_I2C_ADDRESS (0x1d<<1)
Serial pc(USBTX,USBRX);//tx,rx

int main()
{
    int x=0;
    int y=0;
    int z=0;
    MMA8451Q acc(PTE25,PTE24,MMA8451_I2C_ADDRESS);
    
    while(1)
    {
        x=1000*acc.getAccY();
        y=1000*acc.getAccX();
        z=1000*acc.getAccZ();
        
        pc.printf("$%d %d %d;",x,y,z);
        wait(0.1);
        }
        }