![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Se genera un sonido con diferente tono al pulsar cada uno de los tres botones.
Dependencies: Debounced TextLCD mbed
Fork of pid_teclas by
Diff: main.cpp
- Revision:
- 1:933ebb48e31d
- Parent:
- 0:9aa80672eb3d
diff -r 9aa80672eb3d -r 933ebb48e31d main.cpp --- a/main.cpp Wed Oct 16 17:10:11 2013 +0000 +++ b/main.cpp Wed Apr 02 23:39:29 2014 +0000 @@ -11,7 +11,8 @@ DebouncedIn button1(PTC12); DebouncedIn button2(PTC13); DebouncedIn button3(PTC16); - +PwmOut sound(PTD4); + int C1=0x0F; int sp=0,kp=0,kd=0,ki=0,p=1; int main() @@ -29,9 +30,16 @@ while(1) { + if (button1.falling()) { + led1 =!led1; + + sound=0.1f; + wait(0.3); + sound=0; + if (p==1) { ++sp; @@ -65,9 +73,14 @@ lcd.printf("%d", kd); } } + if (button2.falling()) { led2 =!led2; + sound=0.5f; + wait(0.3); + sound=0; + if (p==1) { if (sp==0) // no mostrar nada @@ -125,9 +138,14 @@ } } } + if (button3.falling()) { led3 =!led3; + sound=1.0f; + wait(0.3); + sound=0; + if (p==1) { ++p;