Lauflicht über 12 LED mit 2 LED via BUS + ÜBUNGEN

Dependencies:   mbed

main.cpp

Committer:
Enenkel
Date:
2016-01-13
Revision:
2:a8fc0cbe7e3f
Parent:
1:4f515b1ea527

File content as of revision 2:a8fc0cbe7e3f:

#include "mbed.h" 
// HIMBED Lektion_02e "Lauflicht über 12 LED mit 2 LED via BUS" 
// BULME Graz, 2014-02-09, by Enekel
// AUFGABE:    1) Kopiere diese Software in ein neues Programm 
//                und gib diesem Programm deinen Namen ! 
//             2) Verändere sie so, dass ein Lauflicht über 12 LED ensteht.
//                Je 2 LED sollen hin und her laufen über alle 12 LED
//                Am Anfang und am Ende darf kein LED leuchten !
//                Verwende dazu einen BUS. 
// DEFINITIONEN *************************************************
BusOut led(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1);
//           LSB                                                        MSB

// HAUPTPROGRAMM ***********************************************
int main() {
    led=0xFFFF;                // Alle 12 LED EIN
    wait(1);                   // warte 1 sec.
    while(1) 
        {
            led=0x0000;        //LED    0000 0000 00000
            wait (0.2);
                               //       0000 0000 00001
                               //       0000 0000 00011         
                               //       0000 0000 00110 
                               //       0000 0000 01100
                               //       0000 0000 11000
                               //       0000 0001 10000
                               //   usw
                               //       wieder zurück ! !       
     
        }
}
// *****************   ENDE **********************************
/******************* ÜBUNGEN *********************************
       Var1                     Var2
       Lauflicht mit 3 LED      lauflicht mit 3 LED
       von D1 bis D20           von D20 bis D1
D1     xxx
D2      xxx
D3       xxx 
D4        xxx  
D13        xxx 
D14         xxx 
D15          xxx
D16           xxx
D17            xxx
D18             xxx
D19              xxx 
D20               xxx

       Var3                     Var4
       Lauflicht mit 4 LED      lauflicht mit 4 LED
       von D1 bis D20           von D20 bis D1
D1     xxxx
D2      xxxx
D3       xxxx 
D4        xxxx  
D13        xxxx 
D14         xxxx 
D15          xxxx
D16           xxxx
D17            xxxx
D18             xxxx
D19              xxxx 
D20               xxxx

       Var5                     Var6
       Lauflicht mit 5 LED      lauflicht mit 5 LED
       von D1 bis D20           von D20 bis D1
D1     xxxxx
D2      xxxxx
D3       xxxxx 
D4        xxxxx  
D13        xxxxx 
D14         xxxxx 
D15          xxxxx
D16           xxxxx
D17            xxxxx
D18             xxxxx
D19              xxxxx 
D20               xxxxx

       Var7                     Var8
       Lauflicht mit 6 LED      lauflicht mit 6 LED
       von D1 bis D20           von D20 bis D1
D1     xxxxxx
D2      xxxxxx
D3       xxxxxx 
D4        xxxxxx  
D13        xxxxxx 
D14         xxxxxx 
D15          xxxxxx
D16           xxxxxx
D17            xxxxxx
D18             xxxxxx
D19              xxxxxx        
D20               xxxxxx     
       
****************** ENDE *************************************/