Executable firmware for standard 6-angle output of the Limbic Chair, for use in direct connection with Unity3D via vcomm port (black USB wire). Talks at 100Hz.

Dependencies:   MPU6050a QEI mbed

Fork of Seeed_Grove_3-Axis_Digital_Accelorometer_Example by Seeed

Committer:
mbedAustin
Date:
Fri Sep 05 23:17:37 2014 +0000
Revision:
0:6f0e33b2eb6e
Child:
1:94e29063fb0d
Seeed Grove 3axis Digital Accelerometer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedAustin 0:6f0e33b2eb6e 1 /*****************************************************************************/
mbedAustin 0:6f0e33b2eb6e 2 // Function: Get the accelemeter of the x/y/z axis.
mbedAustin 0:6f0e33b2eb6e 3 // Hardware: Grove - 3-Axis Digital Accelerometer(±1.5g)
mbedAustin 0:6f0e33b2eb6e 4 // Arduino IDE: Arduino-1.0
mbedAustin 0:6f0e33b2eb6e 5 // Author: Frankie.Chu
mbedAustin 0:6f0e33b2eb6e 6 // Date: Jan 10,2013
mbedAustin 0:6f0e33b2eb6e 7 // Version: v0.9b
mbedAustin 0:6f0e33b2eb6e 8 // by www.seeedstudio.com
mbedAustin 0:6f0e33b2eb6e 9 //
mbedAustin 0:6f0e33b2eb6e 10 // This library is free software; you can redistribute it and/or
mbedAustin 0:6f0e33b2eb6e 11 // modify it under the terms of the GNU Lesser General Public
mbedAustin 0:6f0e33b2eb6e 12 // License as published by the Free Software Foundation; either
mbedAustin 0:6f0e33b2eb6e 13 // version 2.1 of the License, or (at your option) any later version.
mbedAustin 0:6f0e33b2eb6e 14 //
mbedAustin 0:6f0e33b2eb6e 15 // This library is distributed in the hope that it will be useful,
mbedAustin 0:6f0e33b2eb6e 16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
mbedAustin 0:6f0e33b2eb6e 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
mbedAustin 0:6f0e33b2eb6e 18 // Lesser General Public License for more details.
mbedAustin 0:6f0e33b2eb6e 19 //
mbedAustin 0:6f0e33b2eb6e 20 // You should have received a copy of the GNU Lesser General Public
mbedAustin 0:6f0e33b2eb6e 21 // License along with this library; if not, write to the Free Software
mbedAustin 0:6f0e33b2eb6e 22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
mbedAustin 0:6f0e33b2eb6e 23 //
mbedAustin 0:6f0e33b2eb6e 24 /*******************************************************************************/
mbedAustin 0:6f0e33b2eb6e 25
mbedAustin 0:6f0e33b2eb6e 26 #include <mbed.h>
mbedAustin 0:6f0e33b2eb6e 27 #include "MMA7660.h"
mbedAustin 0:6f0e33b2eb6e 28
mbedAustin 0:6f0e33b2eb6e 29 MMA7660 accelemeter;
mbedAustin 0:6f0e33b2eb6e 30
mbedAustin 0:6f0e33b2eb6e 31 int main()
mbedAustin 0:6f0e33b2eb6e 32 {
mbedAustin 0:6f0e33b2eb6e 33 int8_t x, y, z;
mbedAustin 0:6f0e33b2eb6e 34 float ax,ay,az;
mbedAustin 0:6f0e33b2eb6e 35 accelemeter.init();
mbedAustin 0:6f0e33b2eb6e 36 while(1){
mbedAustin 0:6f0e33b2eb6e 37 accelemeter.getXYZ(&x,&y,&z);
mbedAustin 0:6f0e33b2eb6e 38 printf("X=%d, Y=%d, Z=%d, ",x,y,z);
mbedAustin 0:6f0e33b2eb6e 39
mbedAustin 0:6f0e33b2eb6e 40 accelemeter.getAcceleration(&ax,&ay,&az);
mbedAustin 0:6f0e33b2eb6e 41 printf("Accleration of X=%2.2fg, Y=%2.2fg, Z=%2.2fg\n\r",ax,ay,az);
mbedAustin 0:6f0e33b2eb6e 42 wait(.5);
mbedAustin 0:6f0e33b2eb6e 43 }
mbedAustin 0:6f0e33b2eb6e 44 }