![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Bertl
main.cpp
- Committer:
- Michi_Jocham
- Date:
- 2015-12-21
- Revision:
- 0:9f717595fa8b
File content as of revision 0:9f717595fa8b:
#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(); } } }