![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Rev 1.0
Fork of MotorTest by
Diff: Dist2Wall_US.cpp
- Revision:
- 3:78f03f96d641
- Parent:
- 1:ef44156a6e44
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Dist2Wall_US.cpp Tue Apr 21 08:04:54 2015 +0000 @@ -0,0 +1,50 @@ + +#include "mbed.h" +#include "Serial_HL.h" +#include "Bertl14.h" +#include "BertlObjects.h" + +void DriveUntilObstacle(); +void Turn180(); + +int main(void) +{ + InitBertl(); + pex.ClearLeds(); + // Damit der Roboter nicht gleich loskoffert + leds = 9; + pex.WaitUntilFrontButtonPressed(); + leds=6; + wait(0.8); + pex.WaitUntilFrontButtonPressed(); + leds=0; + // 2x Button-pressed jetzt gehts los + + while(1) { + DriveUntilObstacle(); + wait(0.5); // Debug wait + Turn180(); + wait(0.5); + } + + return 1; +} + + +void DriveUntilObstacle() +{ + // Motoren ein + // in einer While-Schleife warten bis Distanz kleiner MinDistance + // Motoren aus !!! +} + +void Turn180() +{ + // Motoren auf 0.5 bis 0.7 + // in einer While-Schleife warten bis + // bei !!!beiden!!! Motoren die Ticks für eine 180° Drehung erreicht sind + // Motoren aus +} + + +