by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
Diff: main.cpp
- Revision:
- 0:044febc0d117
diff -r 000000000000 -r 044febc0d117 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Aug 31 16:07:15 2012 +0000 @@ -0,0 +1,10 @@ +/*Sets PWM source to fixed frequency and duty cycle. Observe output on oscilloscope. + */ +#include "mbed.h" +PwmOut PWM1(p21); //create a PWM output called PWM1 on pin 21 +int main() +{ + PWM1.period(0.010); // set PWM period to 10 ms + PWM1=0.5; // set duty cycle to 50% +} +