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.
Fork of Micromouse_beta by
IRSensor.cpp
00001 #include <cmath> 00002 #include "IRSensor.h" 00003 00004 using namespace std; 00005 00006 00007 IRSensor::IRSensor(AnalogIn& distance) : 00008 distance(distance) 00009 {} 00010 00011 IRSensor::~IRSensor() {} 00012 00013 float IRSensor::read() 00014 { 00015 double d = distance * 3.3f; // Change the value to be in the 0 to 3300 range 00016 00017 //DONT TOUCH 00018 //y = 14.098x6 - 147.35x5 + 627.68x4 - 1403.5x3 + 1765.1x2 - 1236.9x + 430.44 POLYNOMFUNKTION AUS EXCEL 00019 float f = 14.098f*((d)*(d)*(d)*(d)*(d)*(d)) - 147.35f*((d)*(d)*(d)*(d)*(d)) + 627.68*((d)*(d)*(d)*(d)) - 1403.5f*((d)*(d)*(d)) + 1765.1f*((d)*(d)) - 1236.9f*(d) + 430.44f; // Lesen der Distanz in [mm] 00020 00021 return f; 00022 }
Generated on Tue Jul 12 2022 17:34:31 by
1.7.2
