asdf
Dependencies: L3GD20 LSM303DLHC mbed
Diff: Headers/Sensors.h
- Revision:
- 2:997f57aee3b7
- Parent:
- 1:cfe6a6ad8dca
- Child:
- 3:1a8a7cc709cc
--- a/Headers/Sensors.h Sat Mar 29 13:25:23 2014 +0000 +++ b/Headers/Sensors.h Thu Apr 03 13:15:40 2014 +0000 @@ -1,10 +1,17 @@ #ifndef SENSORS_H #define SENSORS_H -#include "Core.h" +//#include "Core.h" + +#include "ExponentialAverage.h" #include "L3GD20.h" #include "LSM303DLHC.h" + +float ax, ay, az; +float mx, my, mz; +float gx, gy, gz; + L3GD20 gyro(p9, p10); LSM303DLHC compass(p9, p10); PwmOut ledF(p23); @@ -14,18 +21,18 @@ AnalogIn SenseL(p16); AnalogIn SenseF(p17); -float alpha = 0.2f; -float valL = 0.0; -float valR = 0.0; -float accL = 0; -float accR = 0; - -void collectSample() + + +bool wallFront() +{ + return frontExpAvg.average() > .90; +} +bool wallLeft() { - valL = SenseL.read(); - valR = SenseR.read(); - accL = (alpha * valL) + (1.0 - alpha) * accL; - accR = (alpha * valR) + (1.0 - alpha) * accR; + return SenseL.read() > .94; } - +bool wallRight() +{ + return SenseR.read() > .94; +} #endif \ No newline at end of file