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.
Dependencies: mbed
Fork of Micromouse_alpha_copy_copy by
KontrastSensor.cpp@2:592f01278db4, 2018-04-04 (annotated)
- Committer:
- ruesipat
- Date:
- Wed Apr 04 15:24:28 2018 +0000
- Revision:
- 2:592f01278db4
- Parent:
- 1:d9e840c48b1e
p
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 | 1:d9e840c48b1e | 20 | blackLine = 0; |
| ruesipat | 1:d9e840c48b1e | 21 | float k = kontrast*3300; //sodass in Range bis 3300mV |
| ruesipat | 2:592f01278db4 | 22 | //printf("%.0f\n", k); |
| ruesipat | 1:d9e840c48b1e | 23 | |
| ruesipat | 1:d9e840c48b1e | 24 | if(k >2500){ |
| 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 | } |
