Matteo Andriolo
/
luce_rossa_piezo
.
Revision 0:5daff114eb4a, committed 2016-04-18
- Comitter:
- Karrots3
- Date:
- Mon Apr 18 19:28:48 2016 +0000
- Commit message:
- .;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Apr 18 19:28:48 2016 +0000 @@ -0,0 +1,40 @@ +#include "mbed.h" +DigitalIn bottone(p23); +DigitalOut ledR(p25); +DigitalOut ledG(p24); +DigitalOut ledB(p26); +PwmOut piezo(p22); +bool flag=0; +int c=0; +int main() +{ + while(1) { + + if(bottone==1&& c>0 && c<=10000) { + ledR=0; + flag=0; + c=0; + piezo.period(1.0 / 200.0); + piezo.write(0.5); + wait(2); + piezo.write(0); + wait(0.05); + } else if(bottone==1) { + ledR=1; + flag=1; + } else if (c>10000) { + piezo.period(1.0 / 600.0); + piezo.write(0.5); + wait(1.0 / 2); + piezo.write(0); + wait(0.05); + } + + if(flag==1) { + c++; + } + + wait_ms(1); + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Apr 18 19:28:48 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f \ No newline at end of file