![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
CA 2.4 Original Code
Diff: main.cpp
- Revision:
- 0:c2e106c9f2eb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Jul 26 20:58:58 2020 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" + +DigitalIn fire(p14); +PwmOut spkr(p26); +AnalogIn pot1(p19); +int main(){ +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 +} +}