lab05-app-shield

Dependencies:   C12832 MMA7660

Committer:
namcheol
Date:
Mon May 11 13:03:10 2020 +0000
Revision:
1:e787321cd424
Parent:
0:f31836d48420
lab05-app-shield-3-axis

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dshin 0:f31836d48420 1 #include "mbed.h"
namcheol 1:e787321cd424 2 #include "C12832.h"
namcheol 1:e787321cd424 3 #include "MMA7660.h"
dshin 0:f31836d48420 4
namcheol 1:e787321cd424 5 C12832 lcd(D11, D13, D12, D7, D10); //lcd = (MOSI, SCK, RESET, A0, nCS)
namcheol 1:e787321cd424 6 MMA7660 MMA(D14, D15); //MMA = (I2C_SDA, I2C_SCL)
dshin 0:f31836d48420 7
dshin 0:f31836d48420 8 int main()
dshin 0:f31836d48420 9 {
namcheol 1:e787321cd424 10 lcd.cls(); //clear screen
namcheol 1:e787321cd424 11 lcd.locate(0, 6);
namcheol 1:e787321cd424 12 lcd.printf("Mbed 3-Axis accelerometer!");
namcheol 1:e787321cd424 13 while(true) {
namcheol 1:e787321cd424 14 lcd.locate(0,16);
namcheol 1:e787321cd424 15 lcd.printf("x=%.2f y=%.2f z=%.2f", MMA.x(), MMA.y(), MMA.z());
namcheol 1:e787321cd424 16 thread_sleep_for(100);
dshin 0:f31836d48420 17 }
dshin 0:f31836d48420 18 }