michael hollegha / Mbed 2 deprecated BertlPingPong

Dependencies:   BertlLib mbed

Files at this revision

API Documentation at this revision

Comitter:
hollegha2
Date:
Fri Apr 25 14:38:09 2014 +0000
Child:
1:81bbec75e875
Commit message:
Ping Pong Prog. for Bertl

Changed in this revision

BertlLib.lib Show annotated file Show diff for this revision Revisions of this file
BertlPingPong.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BertlLib.lib	Fri Apr 25 14:38:09 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/hollegha2/code/BertlLib/#e0131e671ea0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BertlPingPong.cpp	Fri Apr 25 14:38:09 2014 +0000
@@ -0,0 +1,61 @@
+
+#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);
+        }
+        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/mbed.bld	Fri Apr 25 14:38:09 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6473597d706e
\ No newline at end of file