RGB Ampel

Dependencies:   mbed

Fork of _B14_Lektion05b by BULME_BERTL14

main.cpp

Committer:
Enenkel
Date:
2015-03-20
Revision:
3:6a11832bb176
Parent:
2:1e32590010a9

File content as of revision 3:6a11832bb176:

/***********************************
name:   _B14_Lektion05b    AMPEL
author: Gottfried Enenkel  HTL BULME
date :  17.3.2015
Aufgabe::
    3 Blaue LEDs ON
    Die RGB LED leuchtet  rot grün blau 
    je 1 sec
Ändere die Software so das eine AMPEL entsteht:
    rot       5 sec
    gelb      1 sec  (rot und grün) 
    grün      4 sec
    grün 3x blinken je 0,4 sec
    gelb grün 2 sec
***********************************/
#include "mbed.h"
// ************ DEKLARATIONEN **************
DigitalOut LED_blue(P1_28);    // Alle Blauen LED gehen auf einen Anschluß
                               // P1..Port1 _28 Anschluß 28     
DigitalOut RGB_bl(P1_24);      // BLAU    
                               // am uP -> P1..Port1 
                               //       -> 24..IO Anschluss 24 
DigitalOut RGB_rt(P1_23);      // ROT        
DigitalOut RGB_gr(P1_25);      // GRÜN P26 geht zum uP Port P1_25 

// ************  HAUPT PROGRAMM **************
int main() {
    RGB_bl=1;  //blau  AUS
    RGB_rt=1;  //rot 
    RGB_gr=1;  //grün
    
    while(1) {
        LED_blue=1;  //blaue LED AUS! 
        wait(1);
        LED_blue=0;  //blaue LED EIN
        RGB_bl=0;    //blau
        wait(1);
        RGB_bl=1;
        RGB_gr=0;    //grün
        wait(1);
        RGB_gr=1;
        RGB_rt=0;    //rot
        wait(1);
        RGB_rt=1;
        wait(1);
    }
 }
 
 // *****************  ENDE  ********************