Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MMA7660 by
Diff: Main.cpp
- Revision:
- 3:9d2894e17d59
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Main.cpp Fri May 09 18:47:52 2014 +0000 @@ -0,0 +1,25 @@ +//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); + }} \ No newline at end of file