asdf

Dependencies:   L3GD20 LSM303DLHC mbed

Headers/Sensors.h

Committer:
goy5022
Date:
2014-03-29
Revision:
1:cfe6a6ad8dca
Parent:
0:c2ec30f28676
Child:
2:997f57aee3b7

File content as of revision 1:cfe6a6ad8dca:

#ifndef SENSORS_H
#define SENSORS_H

#include "Core.h"
#include "L3GD20.h"
#include "LSM303DLHC.h"

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);

float alpha = 0.2f;
float valL = 0.0;
float valR = 0.0;
float accL = 0;
float accR = 0;
        
void collectSample()
{
    valL = SenseL.read();
    valR = SenseR.read();           
    accL = (alpha * valL) + (1.0 - alpha) * accL;
    accR = (alpha * valR) + (1.0 - alpha) * accR;
}

#endif