step 3

Dependencies:   mbed

Revision:
0:dc588b6743b2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Sep 04 03:05:43 2014 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+//Lab 2, step 3
+
+//code given by professor
+Serial pc(USBTX, USBRX);
+
+//establish pwmout on pin 21
+PwmOut pwmbright(p21)
+
+int main()
+    {//begin main
+    //set the duty cycle
+     duty_cycle=0.5; 
+    //set the period
+     period = 0.1;   
+    
+    while (1)
+    {
+        //set computer sampling rate
+    pc.baud(921600);
+    
+    //set the pwm duty cycle coming off pin 21
+    pwmbright.write(duty_cycle);
+    //set the pwm period coming off pin 21
+    pwmbright.period(period); 
+    //wait 1 second before reiterating
+    wait(1);
+    
+    }//end while
+    
+    }//end main
\ No newline at end of file