Grundfunktionen für Micromouse
Dependencies: AutomationElements mbed
Diff: ReadFinalLine.cpp
- Revision:
- 0:e38b500d6e74
- Child:
- 1:4808f55970e8
diff -r 000000000000 -r e38b500d6e74 ReadFinalLine.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ReadFinalLine.cpp Thu Apr 19 11:31:49 2018 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" + +AnalogIn LineSens1(PC_0); +AnalogIn LineSens2(PC_1); + +int ReadFinalLine(void) +{ + int SensorPos = 0; + float MessureValue[2]; + + MessureValue[0] = LineSens1.read(); + MessureValue[1] = LineSens2.read(); + //return MessureValue[1]; + for(SensorPos = 0; SensorPos <= 1; SensorPos++) + { + if(MessureValue[SensorPos] > 1.1 || MessureValue[SensorPos] < 0.01) + { + return 999; + } + } + + + if((MessureValue[0]-MessureValue[1] >=0.2)||(MessureValue[1]-MessureValue[0] >=0.2)) //Erkennt Veränderungen des Untergrundes + { + return 1; //Linie erkannt + } + else + { + return 0; //keine Linie erkannt + } + +} +//MDF = Spannung an ADC Tief +//Schwarz = Spannung an ADC Hoch \ No newline at end of file