bool WaitUntilButtonPressed(); bool FrontIsClear(); bool NextToABeeper(); bool IsButtonPressed(const int btn); int ReturnButtonPressed();
main.cpp@0:af676e438648, 2015-12-21 (annotated)
- Committer:
- Nicholas_
- Date:
- Mon Dec 21 14:31:18 2015 +0000
- Revision:
- 0:af676e438648
bool WaitUntilButtonPressed(); ; bool FrontIsClear(); ; bool NextToABeeper(); ; bool IsButtonPressed(const int btn); ; int ReturnButtonPressed(); ;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nicholas_ | 0:af676e438648 | 1 | #include "mbed.h" |
Nicholas_ | 0:af676e438648 | 2 | #include "const.h" |
Nicholas_ | 0:af676e438648 | 3 | #include "Robot.h" |
Nicholas_ | 0:af676e438648 | 4 | |
Nicholas_ | 0:af676e438648 | 5 | Robot bertl; |
Nicholas_ | 0:af676e438648 | 6 | |
Nicholas_ | 0:af676e438648 | 7 | void Bewegen() |
Nicholas_ | 0:af676e438648 | 8 | { |
Nicholas_ | 0:af676e438648 | 9 | bertl.move(); |
Nicholas_ | 0:af676e438648 | 10 | } |
Nicholas_ | 0:af676e438648 | 11 | |
Nicholas_ | 0:af676e438648 | 12 | void DrehLinks() |
Nicholas_ | 0:af676e438648 | 13 | { |
Nicholas_ | 0:af676e438648 | 14 | bertl.TurnLeft(); |
Nicholas_ | 0:af676e438648 | 15 | } |
Nicholas_ | 0:af676e438648 | 16 | |
Nicholas_ | 0:af676e438648 | 17 | void ViererKette(int value) |
Nicholas_ | 0:af676e438648 | 18 | { |
Nicholas_ | 0:af676e438648 | 19 | bertl.NibbleLeds(value); |
Nicholas_ | 0:af676e438648 | 20 | } |
Nicholas_ | 0:af676e438648 | 21 | |
Nicholas_ | 0:af676e438648 | 22 | void SchalteLedEin(int16_t led) |
Nicholas_ | 0:af676e438648 | 23 | { |
Nicholas_ | 0:af676e438648 | 24 | bertl.TurnLedOn(led); |
Nicholas_ | 0:af676e438648 | 25 | } |
Nicholas_ | 0:af676e438648 | 26 | |
Nicholas_ | 0:af676e438648 | 27 | void SchalteLedAus(int16_t led) |
Nicholas_ | 0:af676e438648 | 28 | { |
Nicholas_ | 0:af676e438648 | 29 | bertl.TurnLedOff(led); |
Nicholas_ | 0:af676e438648 | 30 | } |
Nicholas_ | 0:af676e438648 | 31 | |
Nicholas_ | 0:af676e438648 | 32 | void RotGruenBlauLed(bool red, bool green, bool blue) |
Nicholas_ | 0:af676e438648 | 33 | { |
Nicholas_ | 0:af676e438648 | 34 | bertl.RGBLed(red, green, blue); |
Nicholas_ | 0:af676e438648 | 35 | } |
Nicholas_ | 0:af676e438648 | 36 | |
Nicholas_ | 0:af676e438648 | 37 | void BlaueLedAus() |
Nicholas_ | 0:af676e438648 | 38 | { |
Nicholas_ | 0:af676e438648 | 39 | bertl.BlueLedsOFF(); |
Nicholas_ | 0:af676e438648 | 40 | } |
Nicholas_ | 0:af676e438648 | 41 | |
Nicholas_ | 0:af676e438648 | 42 | void BlaueLedAn() |
Nicholas_ | 0:af676e438648 | 43 | { |
Nicholas_ | 0:af676e438648 | 44 | bertl.BlueLedsON(); |
Nicholas_ | 0:af676e438648 | 45 | } |
Nicholas_ | 0:af676e438648 | 46 | |
Nicholas_ | 0:af676e438648 | 47 | bool WarteBisButtonGedruecktWird() |
Nicholas_ | 0:af676e438648 | 48 | { |
Nicholas_ | 0:af676e438648 | 49 | if(bertl.WaitUntilButtonPressed()) |
Nicholas_ | 0:af676e438648 | 50 | { |
Nicholas_ | 0:af676e438648 | 51 | return true; |
Nicholas_ | 0:af676e438648 | 52 | } else { |
Nicholas_ | 0:af676e438648 | 53 | return false; |
Nicholas_ | 0:af676e438648 | 54 | } |
Nicholas_ | 0:af676e438648 | 55 | } |
Nicholas_ | 0:af676e438648 | 56 | |
Nicholas_ | 0:af676e438648 | 57 | bool VorneFrei() |
Nicholas_ | 0:af676e438648 | 58 | { |
Nicholas_ | 0:af676e438648 | 59 | if(bertl.FrontIsClear()) |
Nicholas_ | 0:af676e438648 | 60 | { |
Nicholas_ | 0:af676e438648 | 61 | return true; |
Nicholas_ | 0:af676e438648 | 62 | } else { |
Nicholas_ | 0:af676e438648 | 63 | return false; |
Nicholas_ | 0:af676e438648 | 64 | } |
Nicholas_ | 0:af676e438648 | 65 | } |
Nicholas_ | 0:af676e438648 | 66 | |
Nicholas_ | 0:af676e438648 | 67 | bool NacheVonStreifen() |
Nicholas_ | 0:af676e438648 | 68 | { |
Nicholas_ | 0:af676e438648 | 69 | if(bertl.NextToABeeper()) |
Nicholas_ | 0:af676e438648 | 70 | { |
Nicholas_ | 0:af676e438648 | 71 | return true; |
Nicholas_ | 0:af676e438648 | 72 | } else { |
Nicholas_ | 0:af676e438648 | 73 | return false; |
Nicholas_ | 0:af676e438648 | 74 | } |
Nicholas_ | 0:af676e438648 | 75 | } |
Nicholas_ | 0:af676e438648 | 76 | |
Nicholas_ | 0:af676e438648 | 77 | bool IstKnopfGedrueckt(const int btn) |
Nicholas_ | 0:af676e438648 | 78 | { |
Nicholas_ | 0:af676e438648 | 79 | if(bertl.IsButtonPressed(btn)) |
Nicholas_ | 0:af676e438648 | 80 | { |
Nicholas_ | 0:af676e438648 | 81 | return true; |
Nicholas_ | 0:af676e438648 | 82 | } else { |
Nicholas_ | 0:af676e438648 | 83 | return false; |
Nicholas_ | 0:af676e438648 | 84 | } |
Nicholas_ | 0:af676e438648 | 85 | } |
Nicholas_ | 0:af676e438648 | 86 | |
Nicholas_ | 0:af676e438648 | 87 | int ZurueckZuKnopfGedrueckt() |
Nicholas_ | 0:af676e438648 | 88 | { |
Nicholas_ | 0:af676e438648 | 89 | if(bertl.ReturnButtonPressed()) |
Nicholas_ | 0:af676e438648 | 90 | { |
Nicholas_ | 0:af676e438648 | 91 | return true; |
Nicholas_ | 0:af676e438648 | 92 | } else { |
Nicholas_ | 0:af676e438648 | 93 | return false; |
Nicholas_ | 0:af676e438648 | 94 | } |
Nicholas_ | 0:af676e438648 | 95 | } |
Nicholas_ | 0:af676e438648 | 96 | |
Nicholas_ | 0:af676e438648 | 97 | int main() |
Nicholas_ | 0:af676e438648 | 98 | { |
Nicholas_ | 0:af676e438648 | 99 | |
Nicholas_ | 0:af676e438648 | 100 | } |
Nicholas_ | 0:af676e438648 | 101 | |
Nicholas_ | 0:af676e438648 | 102 | |
Nicholas_ | 0:af676e438648 | 103 | |
Nicholas_ | 0:af676e438648 | 104 | |
Nicholas_ | 0:af676e438648 | 105 | |
Nicholas_ | 0:af676e438648 | 106 | |
Nicholas_ | 0:af676e438648 | 107 | |
Nicholas_ | 0:af676e438648 | 108 |