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

main.cpp

Committer:
chapfohn
Date:
2013-04-30
Revision:
1:0a7a84edc8e5
Parent:
0:bd0546063b0a
Child:
2:b0a8d3b7a6dd

File content as of revision 1:0a7a84edc8e5:

//Iteration for 3 axis, ...

#include "mbed.h"
#include "MMA7660.h"
#include "C12832_lcd.h"

C12832_LCD lcd;
MMA7660 MMA(p28, p27);

DigitalOut connectionLed(LED1);

int main() {  
    if (MMA.testConnection())
        connectionLed = 1;
        
    while(1) {
        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
    }

}