![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
ES305 Lab 2 Exercise 3 PWM output to OScope
Dependencies: mbed
Revision 0:2da13a76baf2, committed 2014-08-14
- Comitter:
- brianconnett
- Date:
- Thu Aug 14 16:15:16 2014 +0000
- Commit message:
- ES305 Lab 2 Exercise 3; Create a PWM signal to be viewed on the OScope
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 |
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
diff -r 000000000000 -r 2da13a76baf2 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Aug 14 16:15:16 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6213f644d804 \ No newline at end of file