RGB LED - RGB

Dependencies:   mbed

Fork of _B14Test5 by BULME_BERTL14

Committer:
Enenkel
Date:
Fri Mar 20 10:37:45 2015 +0000
Revision:
2:1e32590010a9
Parent:
1:b94490b97a6a
RGB LED

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Enenkel 0:c2a3df878b8a 1 /***********************************
Enenkel 2:1e32590010a9 2 name: _B14_Lektion05a RGB & Blue LED Test
Enenkel 2:1e32590010a9 3 author: Gottfried Enenkel HTL BULME
Enenkel 2:1e32590010a9 4 date : 17.3.2015
Enenkel 2:1e32590010a9 5 Aufgabe::
Enenkel 0:c2a3df878b8a 6 3 Blaue LEDs ON
Enenkel 0:c2a3df878b8a 7 Die RGB LED leuchtet rot grün blau
Enenkel 0:c2a3df878b8a 8 je 1 sec
Enenkel 2:1e32590010a9 9 Ändere die Software wie folgt:
Enenkel 2:1e32590010a9 10 rot 2sec
Enenkel 2:1e32590010a9 11 rot blau 2 sec
Enenkel 2:1e32590010a9 12 blau 2 sec
Enenkel 2:1e32590010a9 13 blau grün 2 sec
Enenkel 2:1e32590010a9 14 grün 2 sec
Enenkel 2:1e32590010a9 15 grün rot 2 sec
Enenkel 2:1e32590010a9 16 rot grün blau 2 sec
Enenkel 0:c2a3df878b8a 17 ***********************************/
Enenkel 0:c2a3df878b8a 18 #include "mbed.h"
Enenkel 0:c2a3df878b8a 19 // ************ DEKLARATIONEN **************
Enenkel 0:c2a3df878b8a 20 DigitalOut LED_blue(P1_28); // Alle Blauen LED gehen auf einen Anschluß
Enenkel 0:c2a3df878b8a 21 // P1..Port1 _28 Anschluß 28
Enenkel 0:c2a3df878b8a 22 DigitalOut RGB_bl(P1_24); // BLAU
Enenkel 0:c2a3df878b8a 23 // am uP -> P1..Port1
Enenkel 0:c2a3df878b8a 24 // -> 24..IO Anschluss 24
Enenkel 0:c2a3df878b8a 25 DigitalOut RGB_rt(P1_23); // ROT
Enenkel 0:c2a3df878b8a 26 DigitalOut RGB_gr(P1_25); // GRÜN P26 geht zum uP Port P1_25
Enenkel 0:c2a3df878b8a 27
Enenkel 0:c2a3df878b8a 28 // ************ HAUPT PROGRAMM **************
Enenkel 0:c2a3df878b8a 29 int main() {
Enenkel 0:c2a3df878b8a 30 RGB_bl=1; //blau AUS
Enenkel 0:c2a3df878b8a 31 RGB_rt=1; //rot
Enenkel 0:c2a3df878b8a 32 RGB_gr=1; //grün
Enenkel 0:c2a3df878b8a 33
Enenkel 0:c2a3df878b8a 34 while(1) {
Enenkel 0:c2a3df878b8a 35 LED_blue=1; //blaue LED AUS!
Enenkel 0:c2a3df878b8a 36 wait(1);
Enenkel 0:c2a3df878b8a 37 LED_blue=0; //blaue LED EIN
Enenkel 0:c2a3df878b8a 38 RGB_bl=0; //blau
Enenkel 0:c2a3df878b8a 39 wait(1);
Enenkel 0:c2a3df878b8a 40 RGB_bl=1;
Enenkel 0:c2a3df878b8a 41 RGB_gr=0; //grün
Enenkel 0:c2a3df878b8a 42 wait(1);
Enenkel 0:c2a3df878b8a 43 RGB_gr=1;
Enenkel 0:c2a3df878b8a 44 RGB_rt=0; //rot
Enenkel 0:c2a3df878b8a 45 wait(1);
Enenkel 0:c2a3df878b8a 46 RGB_rt=1;
Enenkel 0:c2a3df878b8a 47 wait(1);
Enenkel 0:c2a3df878b8a 48 }
Enenkel 0:c2a3df878b8a 49 }
Enenkel 0:c2a3df878b8a 50
Enenkel 0:c2a3df878b8a 51 // ***************** ENDE ********************