For cycle example using PWM outputs to create diferent colors with the on board RGB Led

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
gcarmonar
Date:
Wed Oct 09 21:07:52 2013 +0000
Commit message:
Ver1.0;

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	Wed Oct 09 21:07:52 2013 +0000
@@ -0,0 +1,36 @@
+/* 
+    - Descripcion -
+    Controlar la intensidad de un led RGB y hacer conbinaciones
+    de colores utilizando diferentes tonos.
+    
+    - AYUDA -
+    PwmOut    : Configura un puerto como salida PWM, puedes establece el ciclo
+                trabajo con numeros entre 0 (para 0%) y 1 (para 100%) con decimales
+    float     : Tipo de variable que utiliza numeros decimales
+*/
+
+#include "mbed.h"
+
+PwmOut bled(LED1);
+PwmOut gled(LED2);
+PwmOut rled(LED3);
+
+int main() {
+    // Todos apagados
+    bled = 1;
+    gled = 1;
+    rled = 1;
+    
+    while(1) {
+        for (float i = 0; i <= 1; i = i + 0.2){
+            for (float j = 0; j <= 1; j = j + 0.2){
+                for (float k = 0; k <= 1; k = k + 0.2){
+                    bled = i;
+                    gled = j;
+                    rled = k;
+                    wait(0.25);
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 09 21:07:52 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file