Übungen vom 07.05.15 - Fellegi

Dependencies:   mbed ur_Bertl

Meine Projekte

Diese Projekte habe ich im SS 2015 in FSST programmiert Task_if: Übungen

Files at this revision

API Documentation at this revision

Comitter:
kevinfellegi
Date:
Fri May 08 07:44:49 2015 +0000
Commit message:
?bungen vom 07.05.15 - Fellegi

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
main.h 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
uebungen.cpp Show annotated file Show diff for this revision Revisions of this file
ur_Bertl.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 8bda29c454a3 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri May 08 07:44:49 2015 +0000
@@ -0,0 +1,53 @@
+#include "mbed.h"
+#include "main.h"
+
+Serial bt(p9, p10);
+
+//int xy = 5; 
+//char zeichen;
+    
+int main()
+{
+
+    Task_Bertl karel;
+    
+    int Moves = 1;
+    int Lines = 0;
+    
+    while(true)
+    {
+        bt.printf("Moved times: %d, Lines: %d\n", Moves, Lines);
+        uint8_t val = karel.GetLineValues();
+        karel.NibbleLeds(val);
+        
+        karel.Move(50);
+        Moves++;
+        
+        if (karel.NextToABeeper())
+        {
+            Lines++;
+            karel.Move(50);
+            Moves++;
+        }
+        
+        if (karel.FrontIsClear() == false)
+        {
+            break;
+        }
+    }
+    wait(1);
+    bt.printf("!FrontIsClear, es wurden %d Beeper gefunden, gehe zurueck zum Ausgangspunkt\n", Lines);
+    wait(1);
+    karel.TurnLeft();
+    for(int i = 0; i < Lines; i++)
+    {
+        karel.Move(50);    
+    } 
+    karel.TurnLeft();
+    
+    for (int i = 0; i < (Moves - 1); i++)
+    {
+        karel.Move(50);
+    }
+    
+}
\ No newline at end of file
diff -r 000000000000 -r 8bda29c454a3 main.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.h	Fri May 08 07:44:49 2015 +0000
@@ -0,0 +1,9 @@
+#include "ur_Bertl.h"
+
+class Task_Bertl : public Bertl
+{
+public:
+        void LineFollow();
+        void LineSearch();
+   
+};
\ No newline at end of file
diff -r 000000000000 -r 8bda29c454a3 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri May 08 07:44:49 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8ab26030e058
\ No newline at end of file
diff -r 000000000000 -r 8bda29c454a3 uebungen.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uebungen.cpp	Fri May 08 07:44:49 2015 +0000
@@ -0,0 +1,50 @@
+#include "main.h"
+#include "const.h"
+
+
+void Task_Bertl ::  LineFollow()
+{
+    while(1)
+    {
+        uint8_t val = GetLineValues();  
+        NibbleLeds(val);
+
+        if (val == 6)
+        {
+            Move();
+        }
+        if ((val == 1) || (val == 3) || (val == 7))
+        {
+            TurnLeftStep(1);
+        }
+        if ((val == 8) || (val == 12) || (val == 14))
+        {
+            TurnRigthStep(1);
+        }
+        if (val == 0)
+        {
+            break;
+        }
+
+    }
+}
+
+void Task_Bertl :: LineSearch()
+{
+     uint8_t val = GetLineValues();  
+     NibbleLeds(val);
+    
+    while(val != 9)
+    {
+        
+        uint8_t val = GetLineValues();  
+        NibbleLeds(val);
+        
+        TurnLeftStep(1);
+        if (val == 9)
+        {
+            break;
+        }
+                
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 8bda29c454a3 ur_Bertl.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ur_Bertl.lib	Fri May 08 07:44:49 2015 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/BERTL_CHEL_18/code/ur_Bertl/#3ce84646fd74