Tarea #4 encoder con sonido al utilizar el pulsador

Dependencies:   QEI TextLCD-modificada mbed

Fork of Tarea4 by Sergio Londono

Files at this revision

API Documentation at this revision

Comitter:
walterg
Date:
Wed Apr 09 04:32:17 2014 +0000
Parent:
0:d7388a87aeb7
Commit message:
Tarea #4 encoder

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Nov 15 17:45:21 2013 +0000
+++ b/main.cpp	Wed Apr 09 04:32:17 2014 +0000
@@ -9,7 +9,13 @@
 DebouncedIn set(PTC17);
 AnalogIn Vin(PTB0);
 AnalogOut Vout(PTE30);
-
+PwmOut pw(PTA12);
+float Tdo=1/2093.005;
+float Pdo=Tdo/2;
+float Tre=1/2637.02;
+float Pre=Tre/2;
+float Tmi=1/3135.963;
+float Pmi=Tmi/2;
 Timer t;
 int flag;
 int q;
@@ -125,11 +131,19 @@
 cont=0;
 while(1){
     if(k>=3 && salto.falling()){
-    k=0;    
+    k=0; 
+     pw.period(Tdo);
+            pw.pulsewidth(Pdo);
+            wait(0.1);
+            pw=0;   
     def_posicion(k);
     }  
     if(salto.falling()){  
     ++k;
+     pw.period(Tdo);
+            pw.pulsewidth(Pdo);
+            wait(0.1);
+            pw=0;
     def_posicion(k);
     }
     else if(set.falling()){