RGB LED - RGB
Dependencies: mbed
Fork of _B14_Lektion05a by
main.cpp@0:c2a3df878b8a, 2014-11-13 (annotated)
- Committer:
- Enenkel
- Date:
- Thu Nov 13 18:20:59 2014 +0000
- Revision:
- 0:c2a3df878b8a
- Child:
- 1:b94490b97a6a
RGB LED und blaue LED
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Enenkel | 0:c2a3df878b8a | 1 | /*********************************** |
Enenkel | 0:c2a3df878b8a | 2 | name: BERTL_2014_TEST |
Enenkel | 0:c2a3df878b8a | 3 | author: Gottfried Enenkel HTL BULME |
Enenkel | 0:c2a3df878b8a | 4 | email: ene@bulme.at |
Enenkel | 0:c2a3df878b8a | 5 | description: |
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 | 0:c2a3df878b8a | 9 | ***********************************/ |
Enenkel | 0:c2a3df878b8a | 10 | #include "mbed.h" |
Enenkel | 0:c2a3df878b8a | 11 | // ************ DEKLARATIONEN ************** |
Enenkel | 0:c2a3df878b8a | 12 | DigitalOut LED_blue(P1_28); // Alle Blauen LED gehen auf einen Anschluß |
Enenkel | 0:c2a3df878b8a | 13 | // P1..Port1 _28 Anschluß 28 |
Enenkel | 0:c2a3df878b8a | 14 | DigitalOut RGB_bl(P1_24); // BLAU |
Enenkel | 0:c2a3df878b8a | 15 | // am uP -> P1..Port1 |
Enenkel | 0:c2a3df878b8a | 16 | // -> 24..IO Anschluss 24 |
Enenkel | 0:c2a3df878b8a | 17 | DigitalOut RGB_rt(P1_23); // ROT |
Enenkel | 0:c2a3df878b8a | 18 | DigitalOut RGB_gr(P1_25); // GRÜN P26 geht zum uP Port P1_25 |
Enenkel | 0:c2a3df878b8a | 19 | |
Enenkel | 0:c2a3df878b8a | 20 | // ************ HAUPT PROGRAMM ************** |
Enenkel | 0:c2a3df878b8a | 21 | int main() { |
Enenkel | 0:c2a3df878b8a | 22 | RGB_bl=1; //blau AUS |
Enenkel | 0:c2a3df878b8a | 23 | RGB_rt=1; //rot |
Enenkel | 0:c2a3df878b8a | 24 | RGB_gr=1; //grün |
Enenkel | 0:c2a3df878b8a | 25 | |
Enenkel | 0:c2a3df878b8a | 26 | while(1) { |
Enenkel | 0:c2a3df878b8a | 27 | LED_blue=1; //blaue LED AUS! |
Enenkel | 0:c2a3df878b8a | 28 | wait(1); |
Enenkel | 0:c2a3df878b8a | 29 | LED_blue=0; //blaue LED EIN |
Enenkel | 0:c2a3df878b8a | 30 | RGB_bl=0; //blau |
Enenkel | 0:c2a3df878b8a | 31 | wait(1); |
Enenkel | 0:c2a3df878b8a | 32 | RGB_bl=1; |
Enenkel | 0:c2a3df878b8a | 33 | RGB_gr=0; //grün |
Enenkel | 0:c2a3df878b8a | 34 | wait(1); |
Enenkel | 0:c2a3df878b8a | 35 | RGB_gr=1; |
Enenkel | 0:c2a3df878b8a | 36 | RGB_rt=0; //rot |
Enenkel | 0:c2a3df878b8a | 37 | wait(1); |
Enenkel | 0:c2a3df878b8a | 38 | RGB_rt=1; |
Enenkel | 0:c2a3df878b8a | 39 | wait(1); |
Enenkel | 0:c2a3df878b8a | 40 | } |
Enenkel | 0:c2a3df878b8a | 41 | } |
Enenkel | 0:c2a3df878b8a | 42 | |
Enenkel | 0:c2a3df878b8a | 43 | // ***************** ENDE ******************** |