Test

Dependencies:   mbed 4DGL-uLCD-SE PinDetect

Files at this revision

API Documentation at this revision

Comitter:
nwang309
Date:
Sun Jan 31 20:29:03 2021 +0000
Parent:
2:e8c2301f7523
Commit message:
Test

Changed in this revision

4DGL-uLCD-SE.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/4DGL-uLCD-SE.lib	Sun Jan 31 20:29:03 2021 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/4180_1/code/4DGL-uLCD-SE/#e39a44de229a
--- a/main.cpp	Wed Feb 03 18:24:29 2016 +0000
+++ b/main.cpp	Sun Jan 31 20:29:03 2021 +0000
@@ -1,29 +1,40 @@
+#include "mbed.h"
+#include "uLCD_4DGL.h"
 #include "LSM9DS1.h"
 
-DigitalOut myled(LED1);
-Serial pc(USBTX, USBRX);
+
+uLCD_4DGL uLCD(p13, p14, p12);
+
+Serial pc(USBTX,USBRX);
+
+LSM9DS1 imu(p9, p10, 0xD6, 0x3C);
+
 
 int main() {
-    //LSM9DS1 lol(p9, p10, 0x6B, 0x1E);
-    LSM9DS1 lol(p9, p10, 0xD6, 0x3C);
-    lol.begin();
-    if (!lol.begin()) {
-        pc.printf("Failed to communicate with LSM9DS1.\n");
-    }
-    lol.calibrate();
-    while(1) {
-        lol.readTemp();
-        lol.readMag();
-        lol.readGyro();
-        
-        //pc.printf("%d %d %d %d %d %d %d %d %d\n\r", lol.calcGyro(lol.gx), lol.calcGyro(lol.gy), lol.calcGyro(lol.gz), lol.ax, lol.ay, lol.az, lol.mx, lol.my, lol.mz);
-        //pc.printf("%d %d %d\n\r", lol.calcGyro(lol.gx), lol.calcGyro(lol.gy), lol.calcGyro(lol.gz));
-        pc.printf("gyro: %d %d %d\n\r", lol.gx, lol.gy, lol.gz);
-        pc.printf("accel: %d %d %d\n\r", lol.ax, lol.ay, lol.az);
-        pc.printf("mag: %d %d %d\n\n\r", lol.mx, lol.my, lol.mz);
-        myled = 1;
-        wait(2);
-        myled = 0;
-        wait(2);
-    }
+
+    // Center Location
+    int start_x_pos = 130 / 2;
+    int start_y_pos = 130 /2;
+    
+    imu.calibrate();
+    
+    
+    // Starting Location
+    int x_pos = imu.gx;
+    int y_pos = imu.gy;
+    
+    // Draw big circle
+    uLCD.circle(start_x_pos, start_y_pos, start_x_pos, GREEN);
+    
+    
+    uLCD.circle(start_x_pos, start_y_pos, 8, GREEN);
+    // Draw small filled circle
+    uLCD.filled_circle(x_pos, y_pos, 8, RED);
+    
 }
+
+
+
+
+
+