Control de la intensidad luminosa de un led con control remoto Samsung

Dependencies:   Pulse1 mbed

Files at this revision

API Documentation at this revision

Comitter:
Meli
Date:
Mon Nov 23 08:18:03 2015 +0000
Parent:
0:9727a355c3cd
Commit message:
Control de la intensidad luminosa de un led con control remoto Samsung

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 9727a355c3cd -r e8170a2014a1 main.cpp
--- a/main.cpp	Tue Nov 10 21:50:53 2015 +0000
+++ b/main.cpp	Mon Nov 23 08:18:03 2015 +0000
@@ -1,14 +1,14 @@
 #include "mbed.h"
 #include <Pulse1.h>
-
+ 
 //control remoto 
 PulseInOut irda(PTD5);// en este puerto se pone el sensor infrarrojo
 Serial pc(USBTX, USBRX);
 //DigitalOut ledazul(LED1);
 //DigitalOut led2(LED2);
 PwmOut ledazul(LED1);
-
-
+ 
+ 
 int header =0; //tiempo de cabecera pulso abajo
 const int head_H = 9900; //+10% medida con osciloscopio en microsegundos  9000
 const int head_L = 4983;//-10%  medida con osciloscopio   4530
@@ -19,11 +19,11 @@
 int num[num_bits];//cadena para almacenar todos los tiempos que conforman los bits de datos
 int dato,prender,aumentar,disminuir,j=0; // tiempo de cada dato que se lee
 int var[42];
-
-
+ 
+ 
 float brightness=0;
 float brightness1=1;
-
+ 
 int main(){
     ledazul = 0;
     
@@ -96,7 +96,7 @@
         
        if(aumentar==42) {
                 if (brightness < 1){
-                brightness += 0.1;
+                brightness += 0.2;
                 } 
                 else {
                     brightness = 1;     
@@ -106,16 +106,16 @@
            }
            
         if(disminuir==42) {
-                if (brightness > 0 ){
-                brightness -= 0.1;
+                if ( 1< brightness1){
+                brightness1 -= 0.1;
                 } 
                 else {
-                    brightness = 0;
-                   }
+                    brightness1 = 1;     
+                    }
                 
-              ledazul = brightness;
-           } 
+              ledazul = brightness1;
+           }
+           
         
            
-}
-}
\ No newline at end of file
+}}
\ No newline at end of file