mit pathdingsbums
Dependencies: mbed
Fork of MicroMouse_MASTER_TWO by
Diff: KontrastSensor.cpp
- Revision:
- 1:d9e840c48b1e
- Child:
- 2:592f01278db4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/KontrastSensor.cpp Sat Mar 31 16:45:57 2018 +0000 @@ -0,0 +1,30 @@ +#include <cmath> +#include "KontrastSensor.h" + +using namespace std; + +//IRSensor::IRSensor(AnalogIn& distance, DigitalOut& bit0, DigitalOut& bit1, DigitalOut& bit2, int number) : +// distance(distance), bit0(bit0), bit1(bit1), bit2(bit2) +KontrastSensor::KontrastSensor(AnalogIn& kontrast, int& blackLine) : + kontrast(kontrast), + blackLine(blackLine) +{ + // this->number = number; +} + +KontrastSensor::~KontrastSensor() {} + +void KontrastSensor::check() +{ + + blackLine = 0; + float k = kontrast*3300; //sodass in Range bis 3300mV + printf("%.0f\n", k); + + if(k >2500){ + blackLine = 1; + } + else{//Auschalten im Betrieb (nur zur Kontrolle) + blackLine = 0; + } +}