accelorometer and touch pad
Dependencies: MMA8451Q TSIServo mbed
Fork of FRDM_MMA8451Q by
Diff: main.cpp
- Revision:
- 9:1f50587ada14
- Parent:
- 8:0d24df2d4f18
- Child:
- 10:ac7dd2ffbd14
diff -r 0d24df2d4f18 -r 1f50587ada14 main.cpp --- a/main.cpp Sun Sep 23 04:41:13 2018 +0000 +++ b/main.cpp Thu Sep 27 19:30:17 2018 +0000 @@ -10,16 +10,16 @@ PwmOut g(LED_GREEN); PwmOut b(LED_BLUE); TSISensor tsi; - float readPercentage(); - + while (true) { - 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()); + float x, y, z ; + x = abs(acc.getAccX()); + r= 1.0 - (x*tsi. readPercentage()); + y = abs(acc.getAccY()); + g = 1.0 - (y*tsi. readPercentage()); + z = abs(acc.getAccZ()); + b = 1.0 - (z*tsi. readPercentage()); wait(0.1); } }