part0

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
jaredwil
Date:
Tue Feb 10 20:38:16 2015 +0000
Commit message:
part0;

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 Feb 10 20:38:16 2015 +0000
@@ -0,0 +1,20 @@
+//Lab2 part 0
+//create a waveform
+
+#include "mbed.h"
+
+//Initialize Pwm and freq
+PwmOut PWM1(p21);
+float freq = 400;
+
+//used for debugging
+Serial pc(USBTX, USBRX);
+
+//play tone continuously
+int main() {
+    //Print frequency for debut
+    pc.printf("%f",freq);
+    //Start PWM with appropriate freq
+    PWM1.period(1/freq);                   // set PWM period to 10 ms   
+    PWM1=0.5;                         // set duty cycle to 50% 
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Feb 10 20:38:16 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa
\ No newline at end of file