Bertl sammelt Beeper ein, wenn er auf eine "Wand" hinfährt, dreht sich der Bertl um :)

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
martinale
Date:
Fri Apr 24 08:44:37 2015 +0000
Commit message:
Bertl sammelt Beeper ein, wenn er auf eine "Wand" hinf?hrt, dreht sich der Bertl um :)

Changed in this revision

Robot.lib Show annotated file Show diff for this revision Revisions of this file
main.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
diff -r 000000000000 -r 27a5933a5e04 Robot.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Robot.lib	Fri Apr 24 08:44:37 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/BERTL_CHEL_18/code/ur_Bertl/#207a1e646191
diff -r 000000000000 -r 27a5933a5e04 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Apr 24 08:44:37 2015 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+#include "Robot.h"
+#include "const.h"
+
+class Bertl_Beeper : public Robot
+{
+public:
+    void ClearAllBeeperToTheWall();
+    void TurnAround();
+};
+
+void Bertl_Beeper :: TurnAround()
+{
+    TurnLeft();
+    TurnLeft();
+}
+
+void Bertl_Beeper :: ClearAllBeeperToTheWall()
+{
+    while(FrontIsClear()) 
+    {
+        if(NextToABeeper()) 
+        {
+            PickBeeper();
+            NibbleLeds(AnyBeeperInBag());
+            wait(1);
+            Move();
+        } else
+            Move();
+    }
+}
+
+int main()
+{
+    Bertl_Beeper karel;
+
+    while(1) 
+    {
+        karel.ClearAllBeeperToTheWall();
+        while(!karel.FrontIsClear()) 
+        {
+            karel.TurnAround();
+            break;
+        }
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 27a5933a5e04 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Apr 24 08:44:37 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/433970e64889
\ No newline at end of file