RGB INVERSE LOGIG

Dependencies:   mbed

Fork of _Lektion_03a by BULME_BHEL19

Files at this revision

API Documentation at this revision

Comitter:
Enenkel
Date:
Mon Mar 09 12:10:28 2015 +0000
Commit message:
RGB LED

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Mar 09 12:10:28 2015 +0000
@@ -0,0 +1,47 @@
+//  HIMBED Lektion03a   "Mit der RGB LED blinken"      
+//  BULME GRAZ      by Enenkel     26.2.2014 
+// Aufgabe: 
+// a) Compiliere die Software lade sie und sie was sie tut.
+// b) Verändere die Software wie folgt :
+//    2 sec  weißes Licht; => ROT + GRÜN + BLAU 
+//    .5 sec rotes Licht
+//    2x mit der blauen LED blinken  on = 1 sec off = 1 sec
+//    3x mit der grünen LED blinken  on = 1 sec off = 1 sec
+//    nach 3 sec Pause (alles finster) beginne vom Anfang
+// c) minimiere die Software. (Was schon ist braucht nicht nochmals 
+//    ein - bzw. aus geschalten werden !) 
+#include "mbed.h"
+DigitalOut ledGR(p5);   // grüne LED  wenn es anders ist bitte mir melden ! ! !
+DigitalOut ledBL(p34);  // blaue LED
+DigitalOut ledRT(p36);  // rote  LED
+
+int main()
+{
+    while(1) {
+        ledGR = 1;   // Alle LED ausschalten -> INVERSE LOGIG !
+        ledBL = 1;
+        ledRT = 1;
+        wait(1);  // Warte 1 sec.
+ 
+        ledRT  = 0; // Rote LED einschalten -> INVERSE LOGIG !
+    //  ledGR  = 1; // andere LED ausschalten  
+    //  ledBL  = 1; //     (nicht nötig, da sie schon AUS sind !)
+        wait(1);
+ 
+        ledRT  = 1; // Alle LED ausschalten -> INVERSE LOGIG !
+        ledGR  = 0; // Grüne LED = EIN
+        ledBL  = 1;
+        wait(1);
+        
+        ledRT  = 1; // Alle LED ausschalten -> INVERSE LOGIG !
+        ledGR  = 1;
+        ledBL  = 0; // Blaue LED = EIN
+        wait(1);
+        
+        ledRT = 1; // Alle LED ausschalten -> INVERSE LOGIG !
+        ledGR = 1;
+        ledBL = 1;
+        wait(1);
+    }
+}
+// **************   END ***************
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Mar 09 12:10:28 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5
\ No newline at end of file