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.
main.cpp
- Committer:
- chapfohn
- Date:
- 2013-05-06
- Revision:
- 2:b0a8d3b7a6dd
- Parent:
- 1:0a7a84edc8e5
- Child:
- 3:0d76aaff55b8
File content as of revision 2:b0a8d3b7a6dd:
//Iteration for 3 axis, ... #include "mbed.h" #include "MMA7660.h" #include "C12832_lcd.h" C12832_LCD lcd; MMA7660 MMA(p28, p27); DigitalOut connectionLed(LED1);//for later debug int main() { if (MMA.testConnection()) connectionLed = 1; while(1) { lcd.cls();//clear LCD for next reading round lcd.locate(3,3);//first LCD column label lcd.printf("x-axis | ");//label column lcd.locate(3,14);//xdata location lcd.printf("%.2f\n",MMA.x());//print x to LCD lcd.locate(40,3);//second LCD column label lcd.printf("y-axis | ");//label column lcd.locate(40,14);//ydata location lcd.printf("%.2f\n",MMA.y());//print y to LCD lcd.locate(77,3);//initial LCD location lcd.printf("z-axis");//label column lcd.locate(77,14);//zdata location lcd.printf("%.2f\n",MMA.z());//print z to LCD wait(0.5);//update after 0.5 s } }