M0_Übung_4

Dependencies:   mbed

Fork of M0_Lektion04 by Gottfried Enenkel

main.cpp

Committer:
StefanSeebacher
Date:
2016-04-21
Revision:
1:9cf12e837f53
Parent:
0:37878a820003

File content as of revision 1:9cf12e837f53:

#include "mbed.h" 

// **** DEFINITIONEN ****

DigitalOut ledGR(p5);   
DigitalOut ledBL(p34);  
DigitalOut ledRT(p36);  

BusOut led(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1);

 // **** HAUPTPROGRAMM ****
 
int main()
{
    while(1) 
        {
            ledGR = 1;   
            ledBL = 1;
            ledRT = 1;
            
            led=0x000;        //LED **** **** **** 0000 0000 0000
            wait(0.2);
            led=0x001;        //LED **** **** ***X 0000 0000 0001     
            wait (0.2);
            led=0x003;        //LED **** **** **XX 0000 0000 0011
            wait (0.2);
            led=0x007;        //LED **** **** *XXX 0000 0000 0111
            wait (0.2);
            led=0x00E;        //LED **** **** XXX* 0000 0000 1110
            wait (0.2);
            led=0x01C;        //LED **** ***X XX** 0000 0001 1100
            wait (0.2);
            led=0x038;        //LED **** **XX X*** 0000 0011 1000
            wait (0.2);
            led=0x070;        //LED **** *XXX **** 0000 0111 0000
            wait (0.2);
            led=0x0E0;        //LED **** XXX* **** 0000 1110 0000
            wait (0.2);
            led=0x1C0;        //LED ***X XX** **** 0001 1100 0000 
            wait (0.2);
            led=0x380;        //LED **XX X*** **** 0011 1000 0000 
            wait (0.2);
            led=0x700;        //LED *XXX **** **** 0111 0000 0000 
            wait (0.2);
            led=0xE00;        //LED XXX* **** **** 1110 0000 0000 
            wait (0.2);
            led=0xC00;        //LED XX** **** **** 1100 0000 0000 
            wait (0.2);
            led=0x800;        //LED X*** **** **** 1000 0000 0000 
            wait (0.2);
            led=0x000;        //LED **** **** **** 0000 0000 0000 
            wait (0.2);
            
            ledGR = 1;   
            ledBL = 0;
            ledRT = 1;
            wait(1);
        
            ledGR = 1;   
            ledBL = 1;
            ledRT = 0;
            wait(1);
        
            ledGR = 0;   
            ledBL = 1;
            ledRT = 1;
            wait(1); 
            
            ledGR = 1;   
            ledBL = 1;
            ledRT = 1;
            wait(2);
            
        }
}
// **** ENDE ****