Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
IRSensor.cpp
- Committer:
- luethale
- Date:
- 2018-06-30
- Revision:
- 35:5a4e1a87b3da
- Parent:
- 21:41997651337a
- Child:
- 29:0419f4873807
File content as of revision 35:5a4e1a87b3da:
#include <cmath>
#include "IRSensor.h"
using namespace std;
IRSensor::IRSensor(AnalogIn& distance) :
distance(distance){}
IRSensor::~IRSensor() {}
float IRSensor::readL() {
//Links B2
float d2 = 10.2817f*(1/(pow(distance,1.212121f)));
return d2;
}
float IRSensor::readR(){
//Rechts B1
float d1 = 11.6037f*(1/(pow(distance,1.111111f)));
return d1;
}
float IRSensor::readC(){
//Vorne B4
float d4 = 28.053f*(1.0f/distance);
return d4;
}
//float IRSensor::readB(){}
