PWM, genera una variación en el ancho de pulso mediante el sensor capacitivo (TouchPad) que tiene la tarjeta.

Dependencies:   TSI mbed

/media/uploads/Wilmar87/img_4034.jpg

Files at this revision

API Documentation at this revision

Comitter:
Wilmar87
Date:
Fri Dec 13 04:24:17 2013 +0000
Commit message:
yes;

Changed in this revision

TSI.lib Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
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
diff -r 000000000000 -r 116175c83923 TSI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TSI.lib	Fri Dec 13 04:24:17 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/vsluiter/code/TSI/#4dc2f5a3a731
diff -r 000000000000 -r 116175c83923 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Fri Dec 13 04:24:17 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Wilmar87/code/TextLCD3/#d448298a2d53
diff -r 000000000000 -r 116175c83923 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Dec 13 04:24:17 2013 +0000
@@ -0,0 +1,54 @@
+
+#include "mbed.h"
+#include "TSISensor.h"
+#include "TextLCD.h" 
+
+TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); //-------Puertos LCD rs, e, d4, d5, d6, d7 
+ 
+ float  periodo=90, valor;                         //------ Periodo del pulso
+ int porcentaje;                                   //------ Porcentaje de modificación modular          
+  
+      
+            int main() {
+            
+                PwmOut azul(LED1);
+                //PwmOut Outmotor(PTD4);        //------- Asignamos como salida del pwm el led azul
+                azul=1;                         //------- Led azul Off
+                lcd.printf("******PWM******");
+                wait(1.5);
+                
+                azul.period_ms(periodo);        //------- Asignamos el periodo del pulso al led azul
+                //salida.period_ms(periodo);
+                
+                lcd.cls();
+               
+                lcd.locate(0,0);                //Ubica el periodo del pulso y ciclo de trabajo
+                lcd.printf("T=%gms", periodo);
+                lcd.locate(0,1);
+                lcd.printf("Ciclo T.=");
+                
+                TSISensor tsi;
+ 
+                            while(1){
+                            
+                            valor = tsi.readPercentage(); //Porcentaje leído del sensor capacitivo
+                            
+                            
+                            if(valor!=0) {
+                                
+                                 //Outmotor.write(1.0-porcentaje);
+                                 azul = (1.0-valor);         //Control de la luminosidad del led azul
+                                 porcentaje = (valor)*100;   //Porcentaje del ciclo de trabajo 
+                                 lcd.cls();
+                                 lcd.locate(0,0);            //Ubica el periodo del pulso
+                                 lcd.printf("T=%gms", periodo);                              
+                                 
+                                 lcd.locate(0,3);            //Ubica el ciclo de trabajo obtenido desde el sensor
+                                 lcd.printf("      ");
+                                 lcd.locate(0,1);
+                                 lcd.printf("Ciclo T.=%i", porcentaje);
+    
+                                }        
+                                wait(0.02);
+                            }
+                        }                               
\ No newline at end of file
diff -r 000000000000 -r 116175c83923 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Dec 13 04:24:17 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/1efda918f0ba
\ No newline at end of file