accelorometer and touch pad

Dependencies:   MMA8451Q TSIServo mbed

Fork of FRDM_MMA8451Q by mbed official

Revision:
8:0d24df2d4f18
Parent:
5:bf5becf7469c
Child:
9:1f50587ada14
--- a/main.cpp	Tue Feb 19 23:46:45 2013 +0000
+++ b/main.cpp	Sun Sep 23 04:41:13 2018 +0000
@@ -1,18 +1,25 @@
 #include "mbed.h"
 #include "MMA8451Q.h"
+#include "TSISensor.h"
 
 #define MMA8451_I2C_ADDRESS (0x1d<<1)
 
 int main(void) {
     MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
-    PwmOut rled(LED_RED);
-    PwmOut gled(LED_GREEN);
-    PwmOut bled(LED_BLUE);
+    PwmOut r(LED_RED);
+    PwmOut g(LED_GREEN);
+    PwmOut b(LED_BLUE);
+     TSISensor tsi;
+     float readPercentage();
+     
 
     while (true) {
-        rled = 1.0 - abs(acc.getAccX());
-        gled = 1.0 - abs(acc.getAccY());
-        bled = 1.0 - abs(acc.getAccZ());
+        r = abs(acc.getAccX()* tsi.readPercentage());
+        r = 1.0 - (r*tsi.readPercentage());
+        g = abs(acc.getAccY()* tsi.readPercentage());
+        g = 1.0 - (g*tsi.readPercentage());
+        b = abs(acc.getAccZ()* tsi.readPercentage());
+        b = 1.0 - (b*tsi.readPercentage());
         wait(0.1);
     }
 }