by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
main.cpp@0:044febc0d117, 2012-08-31 (annotated)
- Committer:
- robt
- Date:
- Fri Aug 31 16:07:15 2012 +0000
- Revision:
- 0:044febc0d117
by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
robt | 0:044febc0d117 | 1 | /*Sets PWM source to fixed frequency and duty cycle. Observe output on oscilloscope. |
robt | 0:044febc0d117 | 2 | */ |
robt | 0:044febc0d117 | 3 | #include "mbed.h" |
robt | 0:044febc0d117 | 4 | PwmOut PWM1(p21); //create a PWM output called PWM1 on pin 21 |
robt | 0:044febc0d117 | 5 | int main() |
robt | 0:044febc0d117 | 6 | { |
robt | 0:044febc0d117 | 7 | PWM1.period(0.010); // set PWM period to 10 ms |
robt | 0:044febc0d117 | 8 | PWM1=0.5; // set duty cycle to 50% |
robt | 0:044febc0d117 | 9 | } |
robt | 0:044febc0d117 | 10 |