Test program for the accelerometer on the app shield

Dependencies:   C12832 MMA7660 mbed

Fork of app-shield-LCD by Chris Styles

Files at this revision

API Documentation at this revision

Comitter:
chris
Date:
Thu Feb 06 17:00:28 2014 +0000
Parent:
4:39c7c31b8fb0
Child:
6:67ad992f4baa
Commit message:
First check in

Changed in this revision

MMA7660.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/MMA7660.lib	Thu Feb 06 17:00:28 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Sissors/code/MMA7660/#a8e20db7901e
--- a/main.cpp	Thu Feb 06 15:13:17 2014 +0000
+++ b/main.cpp	Thu Feb 06 17:00:28 2014 +0000
@@ -1,20 +1,20 @@
 #include "mbed.h"
 #include "C12832.h"
+#include "MMA7660.h"
 
 // Using Arduino pin notation
 C12832 lcd(D11, D13, D12, D7, D10);
+MMA7660 MMA(SDA,SCL);
 
 int main()
 {
-    int j=0;
     lcd.cls();
     lcd.locate(0,3);
     lcd.printf("mbed application shield!");
 
-    while(true) {   // this is the third thread
-        lcd.locate(0,15);
-        lcd.printf("Counting : %d",j);
-        j++;
-        wait(1.0);
+    while(1) {
+        lcd.locate(0,14);
+        lcd.printf("x=%.2f y=%.2f z=%.2f",MMA.x(), MMA.y(), MMA.z());
+        wait(0.2);
     }
 }