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 Erik -

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.

/media/uploads/chapfohn/260px-sphere-and-ring_balance_board_underside.jpg /media/uploads/chapfohn/obroc2.gif

/media/uploads/chapfohn/coolboard-balance-board-ultimate-package-medium-bot02-03-w450.png

Files at this revision

API Documentation at this revision

Comitter:
chapfohn
Date:
Tue Apr 30 01:47:56 2013 +0000
Parent:
0:bd0546063b0a
Child:
2:b0a8d3b7a6dd
Commit message:
Built upon MMA7660_HelloWorld to pull out x, y, z axes from device and print to LCD on mbed application board.

Changed in this revision

C12832_lcd.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832_lcd.lib	Tue Apr 30 01:47:56 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/dreschpe/code/C12832_lcd/#468cdccff7af
--- 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
     }
 
 }