Jagdip Manhota
/
MMA7660Accel
Group B accelerometer code
Fork of MMA7660 by
Main.cpp
- Committer:
- MrBushido
- Date:
- 2014-05-09
- Revision:
- 3:9d2894e17d59
File content as of revision 3:9d2894e17d59:
//Uses the measured z-acceleration to drive leds 2 and 3 of the mbed #include "C12832_lcd.h" #include "mbed.h" #include "MMA7660.h" MMA7660 MMA(p28, p27); C12832_LCD lcd; float ax, ay, az ; DigitalOut connectionLed(LED1); PwmOut Zaxis_p(LED2); PwmOut Zaxis_n(LED3); int main() { if (MMA.testConnection()) connectionLed = 1; while(1) { // Accelerometer code wait(1); ax=MMA.x(); // read accelerometer values ay=MMA.y(); az=MMA.z(); lcd.locate(1,11); lcd.printf("MMA: %.4f %.4f %.4f",ax,ay,az); }}