InstrumentationQ4

Dependencies:   mbed

Revision:
0:5918c9abc1ce
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Aug 16 21:47:23 2020 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h" //preprosser commands
+
+DigitalIn fire(p14); //global declarations
+PwmOut spkr(p26); 
+AnalogIn pot1(p19);
+float start = 2000.0, end = 10000.0, step = 100;//variables
+ 
+int main() //main program
+{ 
+        while (1) { 
+            for (float i=start; i<end; i+=step) { 
+            spkr.period(1.0/i); 
+            spkr=0.5; 
+            wait(0.1); 
+        } 
+        spkr=0.0; 
+        start = 3000.0;
+        end = 5000.0;
+        while(pot1.read() < 0.5) {} // this uses the pot to control the program 
+    } 
+}
\ No newline at end of file