michael hollegha
/
BertlTemplate
Start Project for Bertl-Programms
Fork of BertlPingPong by
Revision 3:6bbab92372ef, committed 2015-02-22
- Comitter:
- hollegha2
- Date:
- Sun Feb 22 12:45:34 2015 +0000
- Parent:
- 2:fb6f2a6307d3
- Commit message:
- Init. Revision
Changed in this revision
BertlPingPong.cpp | Show diff for this revision Revisions of this file |
BertlTemplate.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/BertlPingPong.cpp Thu Dec 18 11:08:42 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ - -#include "mbed.h" -#include "Serial_HL.h" -#include "Bertl14.h" -#include "BertlObjects.h" - -int gBlinkMode = 1; -void BlinkTask(); -Timer stw; - -int main(void) -{ - InitBertl(); - pex.useISR=0; leds=9; - pex.ClearLeds(); - - pex.WaitUntilButtonPressed(); - leds=6; wait(0.8); - pex.WaitUntilButtonPressed(); - leds=0; - stw.start(); - while(1) { - pex.ReadButtons(); - if( pex.IsButton(BTN_FLL) ) { - gBlinkMode=1; pex.ClearLeds(); - mL.SetPow(0.2); mR.SetPow(0.9); - } - else if( pex.IsButton(BTN_FRR) ) { - gBlinkMode=2; pex.ClearLeds(); - mL.SetPow(0.9); mR.SetPow(0.2); - } - else if( pex.IsAnyFrontButton() ) { - gBlinkMode=4; pex.ClearLeds(); - mL.SetPow(-0.9); mR.SetPow(-0.9); - } - else if( pex.IsAnyBackButton() ) { - gBlinkMode=3; pex.ClearLeds(); - mL.SetPow(0.9); mR.SetPow(0.9); - } - // Blink dependent on value of gBlinkMode - BlinkTask(); - wait(0.005); - } - - return 1; -} - -void BlinkTask() -{ - if( stw.read_ms()<200 ) - return; - stw.reset(); - if( gBlinkMode==1 ) - pex.ToggleLeds(LED_FL1); - if( gBlinkMode==2 ) - pex.ToggleLeds(LED_FR1); - if( gBlinkMode==3 ) - pex.ToggleLeds(LED_ALL_FRONT); - if( gBlinkMode==4 ) - pex.ToggleLeds(LED_ALL_BACK); -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BertlTemplate.cpp Sun Feb 22 12:45:34 2015 +0000 @@ -0,0 +1,22 @@ + +#include "mbed.h" +#include "Serial_HL.h" +#include "Bertl14.h" +#include "BertlObjects.h" + + + +int main(void) +{ + InitBertl(); + pex.useISR=0; leds=9; + pex.ClearLeds(); + + while(1) + { + } + + return 1; +} + +