Extra Program

Dependencies:   C12832 MMA7660

Revision:
8:f66441d6b175
Parent:
7:adfd46d88d34
--- a/main.cpp	Mon Feb 10 09:42:11 2020 +0000
+++ b/main.cpp	Mon Feb 10 10:01:14 2020 +0000
@@ -1,24 +1,22 @@
 #include "mbed.h"
 #include "C12832.h"
+#include "MMA7660.h"
 
 // Using Arduino pin notation
 C12832 lcd(D11, D13, D12, D7, D10);
 
 int main()
 {
-    AnalogIn pot1 (A0);
-    AnalogIn pot2 (A1);
+    MMA7660 MMA(D14,D15);
     PwmOut r (D5);
     PwmOut g (D8);
     PwmOut b (D9);
 
     while(true) {   // this is the third thread
         
-            r = 1.0 - ((pot1 < 1.0) ? 1.0 - pot1 : (pot1 > 2.0) ? pot1 - 2.0 : 0.0);
-            g = 1.0 - ((pot1 < 1.0) ? pot1 : (pot1 > 2.0) ? 0.0 : 2.0 - pot1);
-            b = 1.0 - ((pot1 < 1.0) ? 0.0 : (pot1 > 2.0) ? 3.0 - pot1 : pot1 - 1.0);  ;
-            lcd.locate(0,3);
-            lcd.printf("Pot 2 = %.2f", (float)pot2);
+            r = MMA.x();
+            g = MMA.y();
+            b = MMA.z();
         wait(0.2);
     }
 }