![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
WHILE_TASK 1 & 2
Meine Projekte
Dieses Projekte habe ich im SS 2015 in FSST programmiert.
Task_if : While Task
Revision 0:26ddfe6c824d, committed 2015-04-24
- Comitter:
- feldgrill1
- Date:
- Fri Apr 24 09:17:19 2015 +0000
- Commit message:
- WHILE_TASK 1 & 2
Changed in this revision
diff -r 000000000000 -r 26ddfe6c824d main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Apr 24 09:17:19 2015 +0000 @@ -0,0 +1,77 @@ +#include "ur_Bertl.h" +#include "mbed.h" +#include "const.h" +#include "Robot.h" + +class task_Bertl : public ur_Bertl +{ +public: + void TurnRight() { + TurnLeft(); + TurnLeft(); + TurnLeft(); + } + void Move2Boxes() { + Move(); + Move(); + } + void ClearAllBeepersToTheWall(); +}; + + + +void task_Bertl :: ClearAllBeepersToTheWall() +{ + while (FrontIsClear()) { + if ( NextToABeeper()) { + PickBeeper(); + Move();} + else { + Move();} + } +} + +int main () +{ + task_Bertl karel; + + // Task 1 & 2 + + while(karel.WaitUntilButtonPressed()){} + + while(karel.IsButtonPressed(BTN_FLL)) { // Vorne Links + karel.TurnLedOn(0x01); + wait(0.3); + karel.TurnLedOn(0x00); + wait(0.3); + } + + while(karel.IsButtonPressed(BTN_FRR)) { // Vorne Rechts + karel.TurnLedOn(0x04); + wait(0.3); + karel.TurnLedOn(0x00); + wait(0.3); + } + + while(karel.IsButtonPressed(BTN_BR)) { // Hinten Rechts + karel.TurnLedOn(0x80 | 0x40); + wait(0.3); + karel.TurnLedOn(0x00); + wait(0.3); + } + + while(karel.IsButtonPressed(BTN_BL)) { // Hinten Links + karel.TurnLedOn(0x20 | 0x10 ); + wait(0.3); + karel.TurnLedOn(0x00); + wait(0.3); + } + + while(!karel.IsButtonPressed(BTN_FLL && BTN_FRR && BTN_BR && BTN_BL)) { + karel.TurnLedOn(0x00);} + + + if(karel.IsButtonPressed(BTN_BM)) + karel.TurnLedOff(0xFF); + +} \ No newline at end of file
diff -r 000000000000 -r 26ddfe6c824d mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Apr 24 09:17:19 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9ad691361fac \ No newline at end of file
diff -r 000000000000 -r 26ddfe6c824d ur_Bertl.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ur_Bertl.lib Fri Apr 24 09:17:19 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/teams/BERTL_CHEL_18/code/ur_Bertl/#207a1e646191