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
Diff: main.cpp
- Revision:
- 1:84592eb27d11
- Parent:
- 0:9aa80672eb3d
- Child:
- 2:8782da14cf8f
--- a/main.cpp Wed Oct 16 17:10:11 2013 +0000 +++ b/main.cpp Wed Apr 23 16:44:18 2014 +0000 @@ -4,6 +4,7 @@ AnalogIn Vin(PTC2); TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5); // rs, e, d4-d7 +PwmOut sonido(PTA12); DigitalOut led1(LED1); DigitalOut led2(LED2); @@ -11,7 +12,6 @@ DebouncedIn button1(PTC12); DebouncedIn button2(PTC13); DebouncedIn button3(PTC16); - int C1=0x0F; int sp=0,kp=0,kd=0,ki=0,p=1; int main() @@ -30,7 +30,11 @@ while(1) { if (button1.falling()) - { + + + { sonido=0.8f; + wait(0.2); + sonido=0.0; led1 =!led1; if (p==1) { @@ -66,7 +70,9 @@ } } if (button2.falling()) - { + { sonido=0.3f; + wait(0.2); + sonido=0.0; led2 =!led2; if (p==1) { @@ -126,7 +132,9 @@ } } if (button3.falling()) - { + { sonido=0.01f; + wait(0.2); + sonido=0.0; led3 =!led3; if (p==1) {