M0_Übung_2d

Dependencies:   mbed

Fork of M0_Lektion02d by Gottfried Enenkel

Files at this revision

API Documentation at this revision

Comitter:
StefanSeebacher
Date:
Thu Apr 21 07:49:43 2016 +0000
Parent:
2:2b9c91113eb3
Commit message:
M0_?bung_2d;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 2b9c91113eb3 -r 5371175f3877 main.cpp
--- a/main.cpp	Wed Jan 06 13:34:10 2016 +0000
+++ b/main.cpp	Thu Apr 21 07:49:43 2016 +0000
@@ -1,41 +1,63 @@
 #include "mbed.h" 
-// HIMBED Lektion_02d   "Lauflicht 8LED via BUS" 
-// by Gottfried ENENKEL  2014-12-12
-// AUFGABE:
-//   Die LED D20 bis D13 werden als BUS definiert.
-//   8 Leitungen -> =2x4 leitungen -> 00 bis FF
-//   2 LED soll hin und her laufen 
-//   Am Anfang und am Ende darf kein LED leuchten !
-//   bei LED 20 beginnen !
-// DEFINITIONEN *************************************************
-// Bus Definition
-// LED D20 geht auf EP113 und weiter auf P0_13
-BusOut led(P1_13,P1_12,P1_7,P1_6,P1_4);
-//         LSB               * Bus ergänzen! *          MSB
+
+// **** DEFINITIONEN ****
 
-// HAUPTPROGRAMM ***********************************************
+BusOut led(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0);
+
+ // **** HAUPTPROGRAMM ****
+ 
 int main() 
 {
-    led=0xFF;                // Alle 8 LED EIN 
-    wait(1);                 // warte 1 sec.   
-    while(1)                 // Hauptschleife
+    while(1)                 
         {
-            led=0x00;        //LED 0000 0000   Hex 00 
+            led=0x00;        //LED **** **** 0000 0000
             wait(0.2);
-            led=0x01;        //LED 0000 0001   Hex 01               
+            led=0x01;        //LED **** ***X 0000 0001     
+            wait (0.2);
+            led=0x03;        //LED **** **XX 0000 0011
+            wait (0.2);
+            led=0x06;        //LED **** *XX* 0000 0110
+            wait (0.2);
+            led=0x0c;        //LED **** XX** 0000 1100
+            wait (0.2);
+            led=0x18;        //LED ***X X*** 0001 1000
+            wait (0.2);
+            led=0x30;        //LED **XX **** 0011 0000
+            wait (0.2);
+            led=0x60;        //LED *XX* **** 0110 0000
+            wait (0.2);
+            led=0xc0;        //LED XX** **** 1100 0000
+            wait (0.2);
+            led=0x80;        //LED X*** **** 1000 0000
+            wait (0.2);
+            led=0x00;        //LED **** **** 0000 0000
             wait (0.2);
-            led=0x03;        //LED 0000 0011   Hex 03
-                     // Ergänze selber in HEX!
-
+            
+            //Zurück
+            
+            led=0x00;        //LED **** **** 0000 0000
+            wait (0.2);
+            led=0x80;        //LED X*** **** 1000 0000
+            wait (0.2);
+            led=0xc0;        //LED XX** **** 1100 0000
+            wait (0.2);
+            led=0x60;        //LED *XX* **** 0110 0000
+            wait (0.2);
+            led=0x30;        //LED **XX **** 0011 0000
             wait (0.2);
-            led=0xFF;        //LED 0000 0110 
-            wait (0.2);  
-                             //LED 0000 1100
-                             //LED 0001 1000
-                             // usw
-                     // dann läuft der Balken wieder zurück!
-                      
+            led=0x18;        //LED ***X X*** 0001 1000
+            wait (0.2);
+            led=0x0c;        //LED **** XX** 0000 1100
+            wait (0.2);
+            led=0x06;        //LED **** *XX* 0000 0110
+            wait (0.2);
+            led=0x03;        //LED **** **XX 0000 0011
+            wait (0.2);
+            led=0x01;        //LED **** ***X 0000 0001     
+            wait (0.2);
+            led=0x00;        //LED **** **** 0000 0000
+            wait(0.2);
+                  
         }
 }
-// ENDE *****************************************************
-
+// **** ENDE ****
\ No newline at end of file