![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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
main.cpp
- Committer:
- mbedAustin
- Date:
- 2014-09-05
- Revision:
- 0:6f0e33b2eb6e
- Child:
- 1:94e29063fb0d
File content as of revision 0:6f0e33b2eb6e:
/*****************************************************************************/ // Function: Get the accelemeter of the x/y/z axis. // Hardware: Grove - 3-Axis Digital Accelerometer(±1.5g) // Arduino IDE: Arduino-1.0 // Author: Frankie.Chu // Date: Jan 10,2013 // Version: v0.9b // by www.seeedstudio.com // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // /*******************************************************************************/ #include <mbed.h> #include "MMA7660.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); } }