Pierre rouaze
/
fastpwmexample
example for using fast pwm
Example for the use of fast pwm on an stm nucleo F302R8.
main.cpp@5:41aafda546a3, 2016-03-31 (annotated)
- Committer:
- rouaze
- Date:
- Thu Mar 31 12:35:28 2016 +0000
- Revision:
- 5:41aafda546a3
- Parent:
- 4:f229692e352f
added comments and the board it was writen for;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rouaze | 0:e89048c4d596 | 1 | #include "mbed.h" |
rouaze | 0:e89048c4d596 | 2 | #include "FastPWM.h" |
rouaze | 5:41aafda546a3 | 3 | //fast pwm example for stm nucleo f302r8 |
rouaze | 5:41aafda546a3 | 4 | FastPWM fastpwm(D11,1); //steup pwm output on pin d11 with a prescaler of 1 |
rouaze | 0:e89048c4d596 | 5 | int main() { |
rouaze | 5:41aafda546a3 | 6 | fastpwm.period_ticks (720); //setup the period for 100Khz |
rouaze | 5:41aafda546a3 | 7 | fastpwm.pulsewidth_ticks( 360);//setup duty cycle to 50% |
rouaze | 0:e89048c4d596 | 8 | while(1) { |
rouaze | 4:f229692e352f | 9 | } |
rouaze | 0:e89048c4d596 | 10 | } |