Vasily Acos
/
Nucleo_pwm_withDIO
Try to use digitalIn and pwm on the same pin. It is not work
Diff: main.cpp
- Revision:
- 0:66e4c4d304b0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Feb 16 12:13:02 2017 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" + + + + +PwmOut mypwm(PA_4); +DigitalInOut din(PA_4); + +//DigitalIn button(PA_0); +//DigitalOut myled(PC_9); + +int main() { + mypwm.period(0.01); + float pulsewidth = 0; + while(1) { + if (pulsewidth>=1.0) pulsewidth=0; + mypwm.write(pulsewidth+=0.1); +// myled = !myled; + wait(1); + } +}