Joseph Forde
/
JF_Speaker
Speakers
main.cpp
- Committer:
- jforde
- Date:
- 2020-07-28
- Revision:
- 4:d693dc6d6e78
- Parent:
- 3:4e35f0d99e64
File content as of revision 4:d693dc6d6e78:
#include "mbed.h" //Preprocessor Directives DigitalIn fire(p14); // Declarations PwmOut spkr(p26); AnalogIn pot1(p19); int main() //instructions in main () function { while (1) { for (float i=2000.0; i<10000.0; i+=100) { spkr.period(1.0/i); spkr=0.5; wait(0.1); } spkr=0.0; while(pot1.read() < 0.5) {} // this uses the pot to control the program } }