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

Committer:
jacobjohnson
Date:
Tue Feb 28 03:59:32 2017 +0000
Revision:
2:85d80e62c081
Parent:
1:94e29063fb0d
Tested and works;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedAustin 0:6f0e33b2eb6e 1
mbedAustin 0:6f0e33b2eb6e 2 #include <mbed.h>
mbedAustin 0:6f0e33b2eb6e 3 #include "MMA7660.h"
jacobjohnson 2:85d80e62c081 4 #include "SeeedGrayOLED.h"
mbedAustin 0:6f0e33b2eb6e 5
mbedAustin 0:6f0e33b2eb6e 6 MMA7660 accelemeter;
mbedAustin 0:6f0e33b2eb6e 7
mbedAustin 0:6f0e33b2eb6e 8 int main()
mbedAustin 0:6f0e33b2eb6e 9 {
mbedAustin 0:6f0e33b2eb6e 10 int8_t x, y, z;
mbedAustin 0:6f0e33b2eb6e 11 float ax,ay,az;
mbedAustin 0:6f0e33b2eb6e 12 accelemeter.init();
jacobjohnson 2:85d80e62c081 13
mbedAustin 0:6f0e33b2eb6e 14 while(1){
mbedAustin 0:6f0e33b2eb6e 15 accelemeter.getXYZ(&x,&y,&z);
mbedAustin 0:6f0e33b2eb6e 16 printf("X=%d, Y=%d, Z=%d, ",x,y,z);
mbedAustin 0:6f0e33b2eb6e 17
jacobjohnson 2:85d80e62c081 18
jacobjohnson 2:85d80e62c081 19
mbedAustin 0:6f0e33b2eb6e 20 accelemeter.getAcceleration(&ax,&ay,&az);
mbedAustin 0:6f0e33b2eb6e 21 printf("Accleration of X=%2.2fg, Y=%2.2fg, Z=%2.2fg\n\r",ax,ay,az);
mbedAustin 0:6f0e33b2eb6e 22 wait(.5);
mbedAustin 0:6f0e33b2eb6e 23 }
mbedAustin 0:6f0e33b2eb6e 24 }