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 Versuch20 by
Classes/LHR.cpp@2:efa9a78591da, 2018-04-25 (annotated)
- Committer:
- baumgant
- Date:
- Wed Apr 25 11:16:16 2018 +0000
- Revision:
- 2:efa9a78591da
- Parent:
- 1:6ef5bc60e69c
- Child:
- 3:f44ef28cfb2d
PES2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
baumgant | 0:b886f13e4ac6 | 1 | #include "LHR.h" |
baumgant | 0:b886f13e4ac6 | 2 | #include "EncoderCounter.h" |
baumgant | 0:b886f13e4ac6 | 3 | #include "Controller.h" |
baumgant | 0:b886f13e4ac6 | 4 | #include "IRSensorGF.h" |
baumgant | 0:b886f13e4ac6 | 5 | #include "IRSensorG.h" |
baumgant | 0:b886f13e4ac6 | 6 | #include "IRSensorK.h" |
baumgant | 0:b886f13e4ac6 | 7 | #include "IRSensorZ.h" |
baumgant | 0:b886f13e4ac6 | 8 | |
baumgant | 0:b886f13e4ac6 | 9 | using namespace std; |
baumgant | 0:b886f13e4ac6 | 10 | |
baumgant | 0:b886f13e4ac6 | 11 | LHR::LHR(IRSensorGF& Sensor1, IRSensorG& Sensor2, IRSensorG& Sensor3, IRSensorK& Sensor4, IRSensorK& Sensor5, IRSensorZ& Sensor6): |
baumgant | 0:b886f13e4ac6 | 12 | Sensor1(Sensor1), Sensor2(Sensor2), Sensor3(Sensor3), Sensor4(Sensor4), Sensor5(Sensor5), Sensor6(Sensor6) |
baumgant | 0:b886f13e4ac6 | 13 | { |
baumgant | 0:b886f13e4ac6 | 14 | this->D = D; |
baumgant | 0:b886f13e4ac6 | 15 | } |
baumgant | 0:b886f13e4ac6 | 16 | |
baumgant | 0:b886f13e4ac6 | 17 | |
baumgant | 0:b886f13e4ac6 | 18 | LHR::~LHR() {} |
baumgant | 0:b886f13e4ac6 | 19 | |
baumgant | 0:b886f13e4ac6 | 20 | int LHR::moving() |
baumgant | 0:b886f13e4ac6 | 21 | { |
mrbb2 | 1:6ef5bc60e69c | 22 | if (1/*Sensor6.read() > 0*/) { //Ziel erreicht |
mrbb2 | 1:6ef5bc60e69c | 23 | |
mrbb2 | 1:6ef5bc60e69c | 24 | if(Sensor4.read() == 0) { |
mrbb2 | 1:6ef5bc60e69c | 25 | D=1; //links Drehen |
baumgant | 0:b886f13e4ac6 | 26 | } else if (Sensor1.read() == 0) { |
mrbb2 | 1:6ef5bc60e69c | 27 | D=2; //gerade |
baumgant | 0:b886f13e4ac6 | 28 | } else if (Sensor5.read() == 0) { |
mrbb2 | 1:6ef5bc60e69c | 29 | D=3; |
baumgant | 2:efa9a78591da | 30 | } else{ |
baumgant | 0:b886f13e4ac6 | 31 | D=4; |
baumgant | 0:b886f13e4ac6 | 32 | } |
baumgant | 0:b886f13e4ac6 | 33 | } else { |
baumgant | 0:b886f13e4ac6 | 34 | D=0; |
baumgant | 0:b886f13e4ac6 | 35 | } |
baumgant | 0:b886f13e4ac6 | 36 | return D; |
baumgant | 0:b886f13e4ac6 | 37 | } |