Maxi Pickl
/
Bertl_uebungen
Clear All Beeper To The Wall
Revision 2:9795f864acac, committed 2015-05-07
- Comitter:
- mpickl
- Date:
- Thu May 07 12:24:26 2015 +0000
- Parent:
- 1:fe621d794c6c
- Commit message:
- Bewegungen z?hlen und Beeper z?hlen;
Changed in this revision
--- a/main.cpp Fri Apr 24 09:17:13 2015 +0000 +++ b/main.cpp Thu May 07 12:24:26 2015 +0000 @@ -10,11 +10,49 @@ #include "ur_Bertl.h" #include "const.h" +Serial bt(p9, p10); + int main() { + int xy = 5; + char zeichen; + Task_Bertl karel; - karel.LedAmpel(); + int Beeper = 0; + int Moves = 1; + + while(true) + { + bt.printf("Move time: %d, Beeper: %d\n", Moves, Beeper); + uint8_t val = karel.GetLineValues(); + + karel.Move(); + Moves++; + + if (karel.NextToABeeper()) + { + Beeper++; + } + } +} + + /*while(true) + { + bt.printf("Zeichen eingeben: "); + bt.scanf("%c", &zeichen); + bt.print("Hello Bertl: %d \n", xy, zeichen); + wait(1); + }*/ + + /*while(1) + { + uint8_t val = karel.GetLineValue(); + karel.NibbleLeds(val); + }*/ + + + //karel.LedAmpel(); /*while(1) { @@ -31,5 +69,27 @@ }*/ // karel.ClearAllBeeperToTheWall(); + +/* int main() +{ + Bertl karel; + + karel.TurnLedOff(LED_ALL); + while(1) + { + uint8_t val = karel.GetLineValues(); + karel.NibbleLeds(val); + + if(val == 6) + { + karel.Move(); + } + + if(val != 6) + { + karel.TurnLeftStep(1); + } + } } +}*/
--- a/uebungen.cpp Fri Apr 24 09:17:13 2015 +0000 +++ b/uebungen.cpp Thu May 07 12:24:26 2015 +0000 @@ -21,62 +21,58 @@ srand(time(0)); int b = 0; + BlueLedsOFF(); + TurnLedOff(LED_ALL); + //RGBLedOFF(); + while(1) { - //if(!IsButtonPressed(BTN_FM)) - //{ - NibbleLeds(0xF8); - wait(1); - NibbleLeds(0xFE); - wait(1); - NibbleLeds(0xF1); - //wait(1); + NibbleLeds(0xF8); + wait(1); + NibbleLeds(0xFE); + wait(1); + NibbleLeds(0xF1); - if (b == 1) - { - wait(5); - } + if (b == 1) + { + wait(5); + } - int y = (rand() % 6) +5; + int y = (rand() % 6) +5; - if(b == 0) + if(b == 0) + { + for(int i = 0; i < y; i++) { - for(int i = 0; i < y; i++) + Move(); + if (IsButtonPressed(BTN_FM)) { - Move(); - if (IsButtonPressed(BTN_FM)) - { - b = 1; - ShutOff(); - break; - } + b = 1; + TurnLedOn(LED_ALL_FRONT); + break; } } - - + } - //if(!IsButtonPressed(BTN_FM)) - //{ - for(int j = 0; j < 4; j++) - { - NibbleLeds(0xF1); - wait_ms(500); - NibbleLeds(0xF0); - wait_ms(500); - } + for(int j = 0; j < 4; j++) + { + NibbleLeds(0xF1); + wait_ms(500); + NibbleLeds(0xF0); + wait_ms(500); + } - NibbleLeds(0xF6); - wait_ms(500); - NibbleLeds(0xF0); - wait_ms(500); - NibbleLeds(0xF8); - //} - //else - //{ - // ShutOff(); - // break; - //} - //} + NibbleLeds(0xF6); + wait_ms(500); + NibbleLeds(0xF0); + wait_ms(500); + NibbleLeds(0xF8); + } +} + +void Task_Bertl :: LineFollow() +{ + } \ No newline at end of file
--- a/uebungen.h Fri Apr 24 09:17:13 2015 +0000 +++ b/uebungen.h Thu May 07 12:24:26 2015 +0000 @@ -1,8 +1,9 @@ #include "ur_Bertl.h" -class Task_Bertl : public ur_Bertl +class Task_Bertl : public Bertl { public: void ClearAllBeeperToTheWall(); void LedAmpel(); + void LineFollow(); }; \ No newline at end of file
--- a/ur_Bertl.lib Fri Apr 24 09:17:13 2015 +0000 +++ b/ur_Bertl.lib Thu May 07 12:24:26 2015 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/BERTL_CHEL_18/code/ur_Bertl/#07e55b300ff1 +http://developer.mbed.org/teams/BERTL_CHEL_18/code/ur_Bertl/#3ce84646fd74