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@4:3c6d2c035243, 2018-05-01 (annotated)
- Committer:
- baumgant
- Date:
- Tue May 01 11:42:38 2018 +0000
- Revision:
- 4:3c6d2c035243
- Parent:
- 3:f44ef28cfb2d
- Child:
- 5:64d7b4b69fdf
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 | |
mrbb2 | 3:f44ef28cfb2d | 9 | |
baumgant | 0:b886f13e4ac6 | 10 | using namespace std; |
baumgant | 0:b886f13e4ac6 | 11 | |
baumgant | 0:b886f13e4ac6 | 12 | LHR::LHR(IRSensorGF& Sensor1, IRSensorG& Sensor2, IRSensorG& Sensor3, IRSensorK& Sensor4, IRSensorK& Sensor5, IRSensorZ& Sensor6): |
baumgant | 0:b886f13e4ac6 | 13 | Sensor1(Sensor1), Sensor2(Sensor2), Sensor3(Sensor3), Sensor4(Sensor4), Sensor5(Sensor5), Sensor6(Sensor6) |
baumgant | 0:b886f13e4ac6 | 14 | { |
baumgant | 0:b886f13e4ac6 | 15 | this->D = D; |
baumgant | 0:b886f13e4ac6 | 16 | } |
baumgant | 0:b886f13e4ac6 | 17 | |
baumgant | 0:b886f13e4ac6 | 18 | |
baumgant | 0:b886f13e4ac6 | 19 | LHR::~LHR() {} |
baumgant | 0:b886f13e4ac6 | 20 | |
baumgant | 0:b886f13e4ac6 | 21 | int LHR::moving() |
baumgant | 0:b886f13e4ac6 | 22 | { |
baumgant | 4:3c6d2c035243 | 23 | if(1/*Sensor6.read() == 0*/) { //Ziel erreicht |
mrbb2 | 1:6ef5bc60e69c | 24 | |
mrbb2 | 1:6ef5bc60e69c | 25 | if(Sensor4.read() == 0) { |
mrbb2 | 1:6ef5bc60e69c | 26 | D=1; //links Drehen |
baumgant | 0:b886f13e4ac6 | 27 | } else if (Sensor1.read() == 0) { |
mrbb2 | 1:6ef5bc60e69c | 28 | D=2; //gerade |
baumgant | 0:b886f13e4ac6 | 29 | } else if (Sensor5.read() == 0) { |
mrbb2 | 1:6ef5bc60e69c | 30 | D=3; |
baumgant | 2:efa9a78591da | 31 | } else{ |
baumgant | 0:b886f13e4ac6 | 32 | D=4; |
baumgant | 0:b886f13e4ac6 | 33 | } |
mrbb2 | 3:f44ef28cfb2d | 34 | |
baumgant | 0:b886f13e4ac6 | 35 | } |
baumgant | 0:b886f13e4ac6 | 36 | return D; |
baumgant | 0:b886f13e4ac6 | 37 | } |