M0_Übung_2c

Dependencies:   mbed

Fork of M0_Lektion02c by Gottfried Enenkel

Files at this revision

API Documentation at this revision

Comitter:
StefanSeebacher
Date:
Thu Apr 21 07:48:03 2016 +0000
Parent:
2:4d97fbc35b11
Commit message:
M0_?bung_2c

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 4d97fbc35b11 -r 73420e7ef6b0 main.cpp
--- a/main.cpp	Wed Jan 06 13:32:24 2016 +0000
+++ b/main.cpp	Thu Apr 21 07:48:03 2016 +0000
@@ -1,37 +1,41 @@
 #include "mbed.h" 
-// HIMBED Lektion_02c   "Lauflicht 4LED via BUS" 
-// by Gottfried ENENKEL  2014-12-12
-// AUFGABE:
-//   Die LED D1 bis D4 werden als BUS definiert.
-//   4 Leitungen -> 16 Möglichkeiten-> 0-F
-//   EIN LED soll hin und her laufen 
-//   Am Anfang und am Ende darf kein LED leuchten !
-//  
-// DEFINITIONEN *************************************************
-// Bus Definition
+
+// **** DEFINITIONEN ****
+
 BusOut led(P1_8,P1_9,P1_10,P1_11);
-//         LSB               MSB
 
-// HAUPTPROGRAMM ***********************************************
+ // **** HAUPTPROGRAMM ****
+ 
 int main() 
 {
-    led=0xF;                // Alle 4 LED EIN 
-    wait(1);                // warte 1 sec.   
-    while(1)                // Hauptschleife
+    while(1)   
         {
-            led=0x0;        //LED 0000   Hex 0 
+            led=0x0;        //LED **** 0000
+            wait(0.2);
+            led=0x1;        //LED ***X 0001
             wait(0.2);
-            led=0x1;        //LED 0001   Hex 1               
+            led=0x2;        //LED **X* 0010        
+            wait (0.2);
+            led=0x4;        //LED *X** 0100
+            wait (0.2);
+            led=0x8;        //LED X*** 1000
             wait (0.2);
-            led=0x2;        //LED 0011 ->Hex 2
-                 // Ergänze selber in HEX!
-
+            
+            //Zurück
+            
+            led=0x0;        //LED **** 0000
+            wait (0.2);
+            led=0x8;        //LED X*** 1000
             wait (0.2);
-            led=0xF;         //LED 1111 
-                             //LED 0000
-                             //LED 1000
-                 // nun läuft der Balken wieder zurück!
+            led=0x4;        //LED *X** 0100
+            wait (0.2);
+            led=0x2;        //LED **X* 0010
+            wait (0.2);
+            led=0x1;        //LED ***X 0001
+            wait (0.2);
+            led=0x0;        //LED **** 0000
+            wait (0.2);
+            
         }
 }
-// *****************    ENDE ***********************************
-
+// **** ENDE ****
\ No newline at end of file