asdf

Dependencies:   L3GD20 LSM303DLHC mbed

Committer:
goy5022
Date:
Thu Apr 03 15:52:54 2014 +0000
Revision:
3:1a8a7cc709cc
Parent:
2:997f57aee3b7
Child:
4:ecfe2115e9a4
PID is a little spotty but is working. Also handbrake just added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
goy5022 0:c2ec30f28676 1 #ifndef SENSORS_H
goy5022 0:c2ec30f28676 2 #define SENSORS_H
goy5022 0:c2ec30f28676 3
goy5022 2:997f57aee3b7 4 //#include "Core.h"
goy5022 2:997f57aee3b7 5
goy5022 2:997f57aee3b7 6 #include "ExponentialAverage.h"
goy5022 0:c2ec30f28676 7 #include "L3GD20.h"
goy5022 0:c2ec30f28676 8 #include "LSM303DLHC.h"
goy5022 0:c2ec30f28676 9
goy5022 2:997f57aee3b7 10
goy5022 2:997f57aee3b7 11 float ax, ay, az;
goy5022 2:997f57aee3b7 12 float mx, my, mz;
goy5022 2:997f57aee3b7 13 float gx, gy, gz;
goy5022 2:997f57aee3b7 14
goy5022 0:c2ec30f28676 15 L3GD20 gyro(p9, p10);
goy5022 0:c2ec30f28676 16 LSM303DLHC compass(p9, p10);
goy5022 1:cfe6a6ad8dca 17 PwmOut ledF(p23);
goy5022 1:cfe6a6ad8dca 18 PwmOut ledR(p21);
goy5022 1:cfe6a6ad8dca 19 PwmOut ledL(p22);
goy5022 1:cfe6a6ad8dca 20 AnalogIn SenseR(p15);
goy5022 1:cfe6a6ad8dca 21 AnalogIn SenseL(p16);
goy5022 1:cfe6a6ad8dca 22 AnalogIn SenseF(p17);
goy5022 3:1a8a7cc709cc 23 bool wallfront = false;
goy5022 3:1a8a7cc709cc 24 bool wallright = false;
goy5022 3:1a8a7cc709cc 25 bool wallleft = false;
goy5022 2:997f57aee3b7 26
goy5022 2:997f57aee3b7 27
goy5022 2:997f57aee3b7 28 bool wallFront()
goy5022 2:997f57aee3b7 29 {
goy5022 2:997f57aee3b7 30 return frontExpAvg.average() > .90;
goy5022 2:997f57aee3b7 31 }
goy5022 2:997f57aee3b7 32 bool wallLeft()
goy5022 1:cfe6a6ad8dca 33 {
goy5022 2:997f57aee3b7 34 return SenseL.read() > .94;
goy5022 1:cfe6a6ad8dca 35 }
goy5022 2:997f57aee3b7 36 bool wallRight()
goy5022 2:997f57aee3b7 37 {
goy5022 2:997f57aee3b7 38 return SenseR.read() > .94;
goy5022 2:997f57aee3b7 39 }
goy5022 3:1a8a7cc709cc 40
goy5022 0:c2ec30f28676 41 #endif