ES305 Lab 2 Exercise 3 PWM output to OScope

Dependencies:   mbed

Revision:
0:2da13a76baf2
diff -r 000000000000 -r 2da13a76baf2 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Aug 14 16:15:16 2014 +0000
@@ -0,0 +1,24 @@
+//****************************************
+//  ES305 Linear Control Systems
+//  Lab 2 - Introduction to mbed microcontroller
+//  Exercise 3 - Pulse Width Modulation
+//  Adjusts Pulse Width Modulation output. From Pin22 and displays on attached Oscilloscope
+//
+//  Brian Connett, LCDR, USN
+//****************************************
+
+#include "mbed.h"                           //mbed header file from mbed.org includes MOST APIs required to operate LPC
+
+PwmOut pwm1(p22);                           //Creates a pulse-width modulation digital output assigned to the variable pwm1 at Pin22
+
+int main()
+{
+
+    pwm1.period(0.010);                     //Set PWM period to 10ms
+    pwm1.period_ms(10);                     //Set PWM period to 10ms (alternative)
+    pwm1.period_us(10000);                  //Set PWM period to 10ms (alternative)
+
+    pwm1.write(0.5);                        //set duty cycle to 50%
+    pwm1=0.5;                               //set duty cycle to 50% (alternative)
+
+}
\ No newline at end of file