Joseph Forde
/
JF_Speaker_1
Speaker_1
Revision 0:4d8659571a83, committed 2020-07-28
- Comitter:
- jforde
- Date:
- Tue Jul 28 11:56:43 2020 +0000
- Commit message:
- Speaker_1
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 Tue Jul 28 11:56:43 2020 +0000 @@ -0,0 +1,27 @@ +#include "mbed.h" //Preprocessor Directives + +DigitalIn fire(p14); // Declarations +PwmOut spkr(p26); +AnalogIn pot1(p19); +float start=2000.0; +float end=10000.0; +float step=100; + +int main() //instructions in main () function +{ + while (1) { + {for (float i= start; i<end; i+=step) { + spkr.period(1.0/i); + spkr=0.5; + wait(0.1);} + {for (float i= start; i<end; i+=step) { + spkr.period(1.0/i); + spkr=0.9; + wait(0.3);} + } + spkr=0.0; + while(pot1.read() < 0.5) {} // this uses the pot to control the program + + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Jul 28 11:56:43 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file