Tarea2-Versión1. Uso de 3 botones para cambiar los parámetros de un PID tal que al presionar cualquiera de los 3 botones se escucha un sonido con distinta frecuencia

Dependencies:   Debounced TextLCD mbed

Fork of Tarea2-V1 by junior andres calle acevedo

Revision:
2:8782da14cf8f
Parent:
1:84592eb27d11
--- a/main.cpp	Wed Apr 23 16:44:18 2014 +0000
+++ b/main.cpp	Mon May 12 05:28:21 2014 +0000
@@ -14,6 +14,10 @@
 DebouncedIn button3(PTC16);
 int C1=0x0F;
 int sp=0,kp=0,kd=0,ki=0,p=1;
+float Dd=10;
+float pp=30;
+float Fi;
+
 int main()
 {
     lcd.cls();
@@ -28,13 +32,15 @@
     lcd.printf("Sp=%d", sp);
 
     while(1)
-    {
+    {Fi=(Dd)*100;
+        pp=(1/Fi);
+        sonido.period(pp);
         if (button1.falling())
-        
-        
-        {   sonido=0.8f;
-            wait(0.2);
-            sonido=0.0;
+        {  
+        sonido.write(0.1);
+            wait(0.1);
+            sonido.write(0);
+            wait(0.1);
             led1 =!led1;
             if (p==1)
             {
@@ -70,9 +76,10 @@
             }
         }
         if (button2.falling())
-        { sonido=0.3f;
-            wait(0.2);
-            sonido=0.0;
+        { sonido.write(0.5);
+            wait(0.1);
+            sonido.write(0.0);
+            wait(0.1);
             led2 =!led2;
             if (p==1)
             {
@@ -132,9 +139,10 @@
             }
         }
         if (button3.falling())
-        { sonido=0.01f;
-            wait(0.2);
-            sonido=0.0;
+        { sonido.write(0.8);
+            wait(0.1);
+            sonido.write(0.0);
+            wait(0.1);
             led3 =!led3;
             if (p==1)
             {