Geradeaus fahren, beeper sammeln bis zur Wand, umdrehen, zurückfahren.
Revision 0:e90affc366bf, committed 2015-05-08
- Comitter:
- DerMax
- Date:
- Fri May 08 08:29:10 2015 +0000
- Commit message:
- Geradeaus fahren, beeper sammeln bis zur Wand, umdrehen, zur?ckfahren.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
ur_Bertl.lib | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r e90affc366bf main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri May 08 08:29:10 2015 +0000 @@ -0,0 +1,49 @@ +#include "ur_Bertl.h" +#include "mbed.h" +#include "Robot.h" +#include "const.h" + +Serial bt(p9, p10); + +void main() +{ + ur_Bertl karel; + + int Beeper = 0; + int Movez = 0; + + + while (karel.FrontIsClear()) + { + karel.Move(); + Movez++; + if (karel.NextToABeeper()) + { + Beeper++; + } + bt.printf("Beeper: %d \n", Beeper); + bt.printf("Move: %d \n", Movez); + wait(1); + + } + if (!karel.FrontIsClear()) + { + karel.TurnLeft(); + for(int i = 0; i < Beeper; i++) + { + karel.Move(); + } + karel.TurnLeft(); + for(int a = 0; a < Movez; a++) + { + karel.Move(); + } + karel.TurnLeft(); + for(int i = 0; i < Beeper; i++) + { + karel.Move(); + } + karel.ShutOff(); + } + +} \ No newline at end of file
diff -r 000000000000 -r e90affc366bf ur_Bertl.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ur_Bertl.lib Fri May 08 08:29:10 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/BERTL_CHEL_18/code/ur_Bertl/#3ce84646fd74