![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Bertl
Diff: main.cpp
- Revision:
- 0:9f717595fa8b
diff -r 000000000000 -r 9f717595fa8b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Dec 21 14:31:11 2015 +0000 @@ -0,0 +1,97 @@ +#include "mbed.h" +#include "const.h" +#include "Robot.h" +#include "ur_Bertl.h" +Robot bertl; +bool Ultraschallsensor () +{ + if(bertl.FrontIsClear()) + { + return true; + } + else + { + return false; + } + +} +void Alarmblinkanlage () +{ + bertl.TurnLedOn(LED_ALL_FRONT); + bertl.TurnLedOn(LED_ALL_BACK); + wait(0.1); + bertl.TurnLedOff(LED_ALL_FRONT); + bertl.TurnLedOff(LED_ALL_BACK); + +} +void FrontscheinwerferAn () +{ + bertl.TurnLedOn(LED_FL1); + bertl.TurnLedOn(LED_FR1); +} +void FrontscheinwerferAus () +{ + bertl.TurnLedOff(LED_FL1); + bertl.TurnLedOff(LED_FR1); +} + + + +void BlinkenLinks() +{ + int a=0; + int b=1; + while(a<b) + { + bertl.TurnLedOn(LED_BL1); + bertl.TurnLedOn(LED_FL2); + wait(0.1); + bertl.TurnLedOff(LED_BL1); + bertl.TurnLedOff(LED_FL2); + a++; + } +} + + +void BlinkenRechts() +{ + int a=0; + int b=1; + while(a<b) + { + bertl.TurnLedOn(LED_FR2); + bertl.TurnLedOn(LED_BR2); + wait(0.1); + bertl.TurnLedOff(LED_FR2); + bertl.TurnLedOff(LED_BR2); + a++; + } +} + + + +int main() +{ + + + while(1) + { + + + if(Ultraschallsensor()) + { + Alarmblinkanlage(); + bertl.MoveBackwards(); + BlinkenLinks(); + bertl.TurnLeft(); + bertl.Move(); + BlinkenRechts(); + bertl.TurnRigth(); + } + else + { + bertl.Move(); + } + + } +}