Example program with the C12832 display and MMA7660 I2C accelerometer of the mbed application shield.

Dependencies:   C12832 MMA7660 mbed

main.cpp

Committer:
screamer
Date:
2014-04-01
Revision:
2:9535cae29d9b
Parent:
1:bad592d14bea
Child:
3:f85ca437ddf8

File content as of revision 2:9535cae29d9b:

#include "mbed.h"
#include "C12832.h"
#include "MMA7660.h"
 
C12832 lcd(D11, D13, D12, D7, D10);
MMA7660 MMA(D14, D15);

int main()
{
    // clear the screen
    lcd.cls();
    
    // print the first line and wait 3 sec
    lcd.locate(0,3);
    
    if (!MMA.testConnection()) {
        lcd.printf("failed to initialize!");
    } else {
        lcd.printf("mbed application board!");
    }
    wait(3);
 
    // print the counter prefix; the number will be printed in the while loop
    int i=1;
    while(i++) {
        lcd.locate(0,15);
        lcd.printf("x: %f, y: %f   ", MMA.x(), MMA.y());
        wait(0.2);
    }
}