Example app for the Grove 3-axis accelerometer on the NCS36510 mbed board.

Dependencies:   Grove_3-Axis_Digital_Accelerometer_MMA7660FC_Library SeeedGrayOLED mbed-os

Fork of Seeed_Grove_3-Axis_Digital_Accelorometer_Example by Seeed

main.cpp

Committer:
jacobjohnson
Date:
2017-02-28
Revision:
2:85d80e62c081
Parent:
1:94e29063fb0d

File content as of revision 2:85d80e62c081:


#include <mbed.h>
#include "MMA7660.h"
#include "SeeedGrayOLED.h"

MMA7660 accelemeter;

int main()
{
    int8_t x, y, z;
    float ax,ay,az;
    accelemeter.init();  
        
    while(1){
        accelemeter.getXYZ(&x,&y,&z);
        printf("X=%d, Y=%d, Z=%d, ",x,y,z);
        
      
            
        accelemeter.getAcceleration(&ax,&ay,&az);
        printf("Accleration of X=%2.2fg, Y=%2.2fg, Z=%2.2fg\n\r",ax,ay,az);
        wait(.5);
    }
}