Dependencies:   MMA8451Q mbed

Revision:
1:a913d88f652c
Parent:
0:4f2fc870fa2a
Child:
2:5de47d55f618
--- a/main.cpp	Thu Feb 22 02:17:25 2018 +0000
+++ b/main.cpp	Thu Feb 22 02:51:08 2018 +0000
@@ -48,12 +48,27 @@
     MMA8451Q acc(SDA, SCL, MMA8451_I2C_ADDRESS);
 
     // PwmOut rled(LED1);
-    PwmOut gled(LED2);
-    PwmOut bled(LED3);
+    // PwmOut gled(LED2);
+    //PwmOut bled(LED3);
 
     printf("MMA8451 ID: %d\r\n", acc.getWhoAmI());
     printf("5 second of data\r\n");
-
+    /*
+        while (on) {
+            // while (true) {
+            float x, y, z;
+            x = abs(acc.getAccX());
+            y = abs(acc.getAccY());
+            z = abs(acc.getAccZ());
+            // rled = 1.0f - x;
+            gled = 1.0f - y;
+            bled = 1.0f - z;
+            wait(0.1f);
+            printf("X: %1.2f, Y: %1.2f, Z: %1.2f\r\n", x, y, z);
+            //wait_ms(0.10);
+        }
+    */
+    float w_time=0.5;
     while (on) {
         // while (true) {
         float x, y, z;
@@ -61,15 +76,15 @@
         y = abs(acc.getAccY());
         z = abs(acc.getAccZ());
         // rled = 1.0f - x;
-        gled = 1.0f - y;
-        bled = 1.0f - z;
+        // gled = 1.0f - y;
+        // bled = 1.0f - z;
         wait(0.1f);
         printf("X: %1.2f, Y: %1.2f, Z: %1.2f\r\n", x, y, z);
         //wait_ms(0.10);
     }
 
-    float w_time=0.5;
-    while(true) {
+    int z=1;
+    while(z==1) {
         for(int a=0; a<20; a++) {
             LED_S[a]=1;
             wait(w_time);
@@ -79,11 +94,14 @@
         for(int a=0; a<20; a++) {
             LED_S[a]=0;
             wait(w_time);
+            printf("in second for loop\r\n");
         }
         wait(w_time);
-
+        z=0;
     }
-
+    
+    printf("Before letters\r\n");
+    
     char Display_Word[]= {'A','B','C','D','E','F','G'};//"ABCDEFG"
     int Word_Num[]= {0,0,0,0,0,0,0};
     for(int w=0; w<7; w++) {