Build upon MMA7660_HelloWorld to pull out x, y, z axes from device and print to LCD on mbed Application Board
Dependencies: C12832_lcd MMA7660 mbed
Fork of MMA7660_HelloWorld by
Here reside bits and pieces of coding that is mostly derivative of the work of others. Mostly extensions and other modifications.
The proprioception board project.
Board design images follow.
Diff: main.cpp
- Revision:
- 1:0a7a84edc8e5
- Parent:
- 0:bd0546063b0a
- Child:
- 2:b0a8d3b7a6dd
--- a/main.cpp Wed Oct 17 16:40:45 2012 +0000 +++ b/main.cpp Tue Apr 30 01:47:56 2013 +0000 @@ -1,21 +1,27 @@ -//Uses the measured z-acceleration to drive leds 2 and 3 of the mbed +//Iteration for 3 axis, ... #include "mbed.h" #include "MMA7660.h" +#include "C12832_lcd.h" +C12832_LCD lcd; MMA7660 MMA(p28, p27); DigitalOut connectionLed(LED1); -PwmOut Zaxis_p(LED2); -PwmOut Zaxis_n(LED3); int main() { if (MMA.testConnection()) connectionLed = 1; while(1) { - Zaxis_p = MMA.z(); - Zaxis_n = -MMA.z(); + lcd.cls();//clear LCD for next reading round + lcd.locate(3,3);//initial LCD location + lcd.printf("%.2f\n",MMA.x());//print x to LCD + lcd.locate(28,3);//move LCD location + lcd.printf("%.2f\n",MMA.y());//print y to LCD + lcd.locate(53,3);//move LCD location + lcd.printf("%.2f\n",MMA.z());//print z to LCD + wait(0.5);//update after 0.5 s } }