asdf

Dependencies:   L3GD20 LSM303DLHC mbed

Headers/Sensors.h

Committer:
goy5022
Date:
2014-04-03
Revision:
4:ecfe2115e9a4
Parent:
3:1a8a7cc709cc
Child:
5:9e504a5a1f48

File content as of revision 4:ecfe2115e9a4:

#ifndef SENSORS_H
#define SENSORS_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);
PwmOut ledR(p21);
PwmOut ledL(p22);
AnalogIn SenseR(p15);
AnalogIn SenseL(p16);
AnalogIn SenseF(p17);
bool wallfront = false;
bool wallright = false;
bool wallleft = false;
float cal_R =0, cal_L =0, cal_F =0;


bool wallFront()
{
    return frontExpAvg.average() > .90;
}
bool wallLeft()
{
    return abs(log(1-SenseL.read())) < 5;
}
bool wallRight()
{
    return abs(log(1-SenseR.read())) < 5;
}
void check_walls()
{
  wallLeft();
  wallRight();
  wallFront();  
    
}
#endif