Projekt LCD
/
Bertel_PingDONG
Letft Curve, Right Curve, Forward
Fork of BertlTemplate2 by
Revision 2:d40301306dd7, committed 2016-02-29
- Comitter:
- TFuchsbichler
- Date:
- Mon Feb 29 07:50:08 2016 +0000
- Parent:
- 1:1e5f2230c2b8
- Commit message:
- dfssfdfsd
Changed in this revision
diff -r 1e5f2230c2b8 -r d40301306dd7 Bertel_PingDONG.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Bertel_PingDONG.cpp Mon Feb 29 07:50:08 2016 +0000 @@ -0,0 +1,75 @@ +#include "mbed.h" +#include "Serial_HL.h" +#include "Bertl14.h" +#include "BertlObjects.h" + +BusOut boardPow(p30, P1_6,P1_7); + +Timer t_main; +Timer t_blink; + +void Forward(); +void RightCurve(); +void LeftCurve(); + +int main(void) { + boardPow=1; wait_ms(10); + InitBertl(); + pex.useISR=0; leds=9; + pex.ClearLeds(); + pex.WaitUntilFrontButtonPressed(); + t_main.start(); + t_blink.start(); + + while(1) { + pex.ReadButtons(); + if(pex.IsButton(BTN_FM)) Forward(); + if(pex.IsButton(BTN_FRR)) RightCurve(); + if(pex.IsButton(BTN_FLL)) LeftCurve(); + } +} + +void Forward() { + t_main.reset(); + t_blink.reset(); + mL.SetPow(0.3);mR.SetPow(0.3); + + while (t_main.read_ms() < 5000) { + if (t_blink.read_ms() > 100) { + t_blink.reset(); + pex.ToggleLeds(LED_FL1|LED_FR1); + } + } + pex.ClearLeds(); + mL.SetPow(0);mR.SetPow(0); +} + +void RightCurve() { + t_main.reset(); + t_blink.reset(); + mL.SetPow(0.3);mR.SetPow(0.15); + + while (t_main.read_ms() < 5000) { + if (t_blink.read_ms() > 100) { + t_blink.reset(); + pex.ToggleLeds(LED_FR1); + } + } + pex.ClearLeds(); + mL.SetPow(0);mR.SetPow(0); +} + +void LeftCurve() { + t_main.reset(); + t_blink.reset(); + mL.SetPow(0.15);mR.SetPow(0.3); + + while (t_main.read_ms() < 5000) { + if (t_blink.read_ms() > 100) { + t_blink.reset(); + pex.ToggleLeds(LED_FL1); + } + } + pex.ClearLeds(); + mL.SetPow(0);mR.SetPow(0); +} \ No newline at end of file
diff -r 1e5f2230c2b8 -r d40301306dd7 BertlLib.lib --- a/BertlLib.lib Tue Feb 24 03:59:05 2015 +0000 +++ b/BertlLib.lib Mon Feb 29 07:50:08 2016 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/hollegha2/code/BertlLib/#16a5d3302ddb +http://developer.mbed.org/users/hollegha2/code/BertlLib/#78243412d2b3
diff -r 1e5f2230c2b8 -r d40301306dd7 BertlTemplate.cpp --- a/BertlTemplate.cpp Tue Feb 24 03:59:05 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ - -#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; -} - -