![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Fertige Version mit geschwindigkeit 100
Dependencies: mbed
Fork of Micromouse_alpha_copy_copy by
KontrastSensor.cpp@6:a09d2ee3b82e, 2018-04-25 (annotated)
- Committer:
- ruesipat
- Date:
- Wed Apr 25 12:49:48 2018 +0000
- Revision:
- 6:a09d2ee3b82e
- Parent:
- 2:592f01278db4
- Child:
- 7:5ff551b098f8
25.04.2018_MIT Zielerkennung
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ruesipat | 1:d9e840c48b1e | 1 | #include <cmath> |
ruesipat | 1:d9e840c48b1e | 2 | #include "KontrastSensor.h" |
ruesipat | 1:d9e840c48b1e | 3 | |
ruesipat | 1:d9e840c48b1e | 4 | using namespace std; |
ruesipat | 1:d9e840c48b1e | 5 | |
ruesipat | 1:d9e840c48b1e | 6 | //IRSensor::IRSensor(AnalogIn& distance, DigitalOut& bit0, DigitalOut& bit1, DigitalOut& bit2, int number) : |
ruesipat | 1:d9e840c48b1e | 7 | // distance(distance), bit0(bit0), bit1(bit1), bit2(bit2) |
ruesipat | 1:d9e840c48b1e | 8 | KontrastSensor::KontrastSensor(AnalogIn& kontrast, int& blackLine) : |
ruesipat | 1:d9e840c48b1e | 9 | kontrast(kontrast), |
ruesipat | 1:d9e840c48b1e | 10 | blackLine(blackLine) |
ruesipat | 1:d9e840c48b1e | 11 | { |
ruesipat | 1:d9e840c48b1e | 12 | // this->number = number; |
ruesipat | 1:d9e840c48b1e | 13 | } |
ruesipat | 1:d9e840c48b1e | 14 | |
ruesipat | 1:d9e840c48b1e | 15 | KontrastSensor::~KontrastSensor() {} |
ruesipat | 1:d9e840c48b1e | 16 | |
ruesipat | 1:d9e840c48b1e | 17 | void KontrastSensor::check() |
ruesipat | 1:d9e840c48b1e | 18 | { |
ruesipat | 1:d9e840c48b1e | 19 | |
ruesipat | 6:a09d2ee3b82e | 20 | |
ruesipat | 1:d9e840c48b1e | 21 | float k = kontrast*3300; //sodass in Range bis 3300mV |
ruesipat | 6:a09d2ee3b82e | 22 | printf("%.0f\n\r", k); |
ruesipat | 1:d9e840c48b1e | 23 | |
ruesipat | 6:a09d2ee3b82e | 24 | if(k >1300){ |
ruesipat | 1:d9e840c48b1e | 25 | blackLine = 1; |
ruesipat | 1:d9e840c48b1e | 26 | } |
ruesipat | 2:592f01278db4 | 27 | //else{//Auschalten im Betrieb (nur zur Kontrolle) |
ruesipat | 2:592f01278db4 | 28 | // blackLine = 0; |
ruesipat | 2:592f01278db4 | 29 | //} |
ruesipat | 1:d9e840c48b1e | 30 | } |