Mech Lab / Mbed 2 deprecated ME21001_Lab02_Exercise_06

Dependencies:   mbed

Revision:
0:80071421e22f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Sep 23 17:51:37 2017 +0000
@@ -0,0 +1,15 @@
+#include "mbed.h"
+
+DigitalOut speaker(p26); // use onboard loudspeaker #1
+
+
+int main() {
+
+    
+    while(1) {          //starts indefinite loop
+        speaker = 1;    //turns on loudspeaker
+        wait(0.001);    //for frequency 500Hz
+        speaker = 0;    //turns off loudspeaker
+        wait(0.001);    //for frequency 500Hz
+    }
+}