Val Glynn
/
2_4_Modified_Code
CA 2.4 Modified Code
Revision 0:0df3fe870ad4, committed 2020-07-26
- Comitter:
- vmg
- Date:
- Sun Jul 26 21:00:23 2020 +0000
- Commit message:
- CA 2.4 Modified Code
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 |
diff -r 000000000000 -r 0df3fe870ad4 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Jul 26 21:00:23 2020 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" + +DigitalIn fire(p14); +PwmOut spkr(p26); +AnalogIn pot1(p19); +float start=2000.0; +float end=10000.0; +float step=200.0; + +int main(){ + while (1) { + for (float i=start; i<end; i+=step) { + spkr.period(5.0/i); + spkr=(0.5); + wait(0.1); + } + spkr=0.0; + start=9000.0; + while(pot1.read() < 0.5) {} // this uses the pot to control the program + } +} + +
diff -r 000000000000 -r 0df3fe870ad4 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Jul 26 21:00:23 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file