lab05-app-shield

Dependencies:   C12832 MMA7660

Files at this revision

API Documentation at this revision

Comitter:
namcheol
Date:
Mon May 11 13:03:10 2020 +0000
Parent:
0:f31836d48420
Commit message:
lab05-app-shield-3-axis

Changed in this revision

C12832.lib Show annotated file Show diff for this revision Revisions of this file
MMA7660.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832.lib	Mon May 11 13:03:10 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/chris/code/C12832/#7de323fa46fe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA7660.lib	Mon May 11 13:03:10 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/Sissors/code/MMA7660/#36a163511e34
--- a/main.cpp	Sun Mar 29 19:41:28 2020 +0000
+++ b/main.cpp	Mon May 11 13:03:10 2020 +0000
@@ -1,18 +1,18 @@
 #include "mbed.h"
+#include "C12832.h"
+#include "MMA7660.h"
 
-// https://os.mbed.com/docs/mbed-os/v5.15/tools/creating-a-new-program.html
-
-Serial pc(USBTX, USBRX, 115200);    // baud rate 115200
-DigitalOut led(LED1);               // led = LED1
+C12832 lcd(D11, D13, D12, D7, D10); //lcd = (MOSI, SCK, RESET, A0, nCS)
+MMA7660 MMA(D14, D15);              //MMA = (I2C_SDA, I2C_SCL)
 
 int main()
 {
-    while (true) {
-        led = 0;
-        printf("LED1 is ON\r\n");
-        thread_sleep_for(500);
-        led = 1;
-        printf("LED1 is OFF\r\n");
-        thread_sleep_for(500);
+    lcd.cls();  //clear screen
+    lcd.locate(0, 6);
+    lcd.printf("Mbed 3-Axis accelerometer!");
+    while(true) {
+        lcd.locate(0,16);
+        lcd.printf("x=%.2f y=%.2f z=%.2f", MMA.x(), MMA.y(), MMA.z());
+        thread_sleep_for(100);
     }
 }
\ No newline at end of file