by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*Sets PWM source to fixed frequency and duty cycle. Observe output on oscilloscope.
00002                                                                    */
00003 #include "mbed.h"
00004 PwmOut PWM1(p21);               //create a PWM output called PWM1 on pin 21
00005 int main()
00006 {
00007     PWM1.period(0.010);                // set PWM period to 10 ms
00008     PWM1=0.5;                         // set duty cycle to 50%
00009 }
00010