Austin Xiao
/
Nucleo_pwm
g
main.cpp@0:49825face242, 2017-03-23 (annotated)
- Committer:
- kolanery
- Date:
- Thu Mar 23 04:32:22 2017 +0000
- Revision:
- 0:49825face242
d
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kolanery | 0:49825face242 | 1 | #include "mbed.h" |
kolanery | 0:49825face242 | 2 | |
kolanery | 0:49825face242 | 3 | PwmOut mypwm(PWM_OUT); |
kolanery | 0:49825face242 | 4 | |
kolanery | 0:49825face242 | 5 | DigitalOut myled(LED1); |
kolanery | 0:49825face242 | 6 | |
kolanery | 0:49825face242 | 7 | int main() { |
kolanery | 0:49825face242 | 8 | |
kolanery | 0:49825face242 | 9 | mypwm.period_ms(10); |
kolanery | 0:49825face242 | 10 | mypwm.pulsewidth_ms(1); |
kolanery | 0:49825face242 | 11 | |
kolanery | 0:49825face242 | 12 | printf("pwm set to %.2f %%\n", mypwm.read() * 100); |
kolanery | 0:49825face242 | 13 | |
kolanery | 0:49825face242 | 14 | while(1) { |
kolanery | 0:49825face242 | 15 | myled = !myled; |
kolanery | 0:49825face242 | 16 | wait(1); |
kolanery | 0:49825face242 | 17 | } |
kolanery | 0:49825face242 | 18 | } |