Sets up LCD and prints sensor data value of MMA7660 accelerometer sensor to LCD

Dependencies:   C12832 MMA7660 Sht31

Fork of mbed-cloud-connect-sensor-light by Andrea Corrado

main.cpp

Committer:
andcor02
Date:
2017-11-02
Revision:
4:ef7abafa9884
Parent:
3:1ed9495c9158

File content as of revision 4:ef7abafa9884:

#include "mbed.h"
#include "C12832.h"
#include "MMA7660.h"

/* Sets up LCD and prints sensor data value of Indoor Air Quality sensor to LCD */

C12832 lcd(PE_14, PE_12, PD_12, PD_11, PE_9); //LCD: MOSI, SCK, RESET, A0, nCS
MMA7660 MMA(PF_0, PF_1); //ACCELEROMETER: I2C_SDA, I2C_SCL 

int main()
{
    while(1) {
        lcd.cls();
        lcd.locate(0,3);
        lcd.printf("[ACCEL]");
        lcd.locate(0,14);
        lcd.printf("x=%.2f y=%.2f z=%.2f",MMA.x(), MMA.y(), MMA.z()); // Print to LCD values
        wait(1);
    }
}