Cambio de parametros PID con tres pulsadores (incremental, decremental y cambio) con sonido

Dependencies:   Debounced TextLCD mbed

Fork of pid_teclas by Gustavo Ramirez

Revision:
1:ab52c079267a
Parent:
0:9aa80672eb3d
--- a/main.cpp	Wed Oct 16 17:10:11 2013 +0000
+++ b/main.cpp	Wed Apr 23 15:03:43 2014 +0000
@@ -1,3 +1,9 @@
+//Este programa se basó en el programa de tony63 teclas_PID
+
+
+//Julian Esteban Palacio Hernandez
+//Andres Mauricio Gomez Arevalo
+
 #include "mbed.h"
 #include "DebouncedIn.h"
 #include "TextLCD.h"
@@ -12,6 +18,11 @@
 DebouncedIn button2(PTC13);
 DebouncedIn button3(PTC16);
 
+PwmOut Sonido(PTA5);
+
+
+float periodo;
+float Frecuencia=1000;
 int C1=0x0F;
 int sp=0,kp=0,kd=0,ki=0,p=1;
 int main()
@@ -29,8 +40,17 @@
 
     while(1)
     {
+        
+        periodo=(1/Frecuencia);
+        Sonido.period(periodo);     
+        
+        
         if (button1.falling())
         {
+            
+            Sonido.write(0.5);
+            wait(0.1);
+            Sonido.write(0);
             led1 =!led1;
             if (p==1)
             {
@@ -67,6 +87,10 @@
         }
         if (button2.falling())
         {
+            
+            Sonido.write(0.5);
+            wait(0.1);
+            Sonido.write(0);
             led2 =!led2;
             if (p==1)
             {
@@ -127,6 +151,10 @@
         }
         if (button3.falling())
         {
+            
+            Sonido.write(0.5);
+            wait(0.1);
+            Sonido.write(0);
             led3 =!led3;
             if (p==1)
             {