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

Committer:
andcor02
Date:
Thu Jan 11 12:29:03 2018 +0000
Revision:
5:eaa094f24727
Parent:
4:ef7abafa9884
updated to mbed os latest

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andcor02 0:80032665d37e 1 #include "mbed.h"
andcor02 0:80032665d37e 2 #include "C12832.h"
andcor02 4:ef7abafa9884 3 #include "MMA7660.h"
andcor02 0:80032665d37e 4
andcor02 0:80032665d37e 5 /* Sets up LCD and prints sensor data value of Indoor Air Quality sensor to LCD */
andcor02 0:80032665d37e 6
andcor02 0:80032665d37e 7 C12832 lcd(PE_14, PE_12, PD_12, PD_11, PE_9); //LCD: MOSI, SCK, RESET, A0, nCS
andcor02 4:ef7abafa9884 8 MMA7660 MMA(PF_0, PF_1); //ACCELEROMETER: I2C_SDA, I2C_SCL
andcor02 0:80032665d37e 9
andcor02 0:80032665d37e 10 int main()
andcor02 0:80032665d37e 11 {
andcor02 0:80032665d37e 12 while(1) {
andcor02 3:1ed9495c9158 13 lcd.cls();
andcor02 0:80032665d37e 14 lcd.locate(0,3);
andcor02 4:ef7abafa9884 15 lcd.printf("[ACCEL]");
andcor02 3:1ed9495c9158 16 lcd.locate(0,14);
andcor02 4:ef7abafa9884 17 lcd.printf("x=%.2f y=%.2f z=%.2f",MMA.x(), MMA.y(), MMA.z()); // Print to LCD values
andcor02 4:ef7abafa9884 18 wait(1);
andcor02 0:80032665d37e 19 }
andcor02 2:587b4d7444d1 20 }