Vasily Acos
/
Nucleo_pwm_withDIO
Try to use digitalIn and pwm on the same pin. It is not work
Revision 0:66e4c4d304b0, committed 2017-02-16
- Comitter:
- acos
- Date:
- Thu Feb 16 12:13:02 2017 +0000
- Commit message:
- why it isn't work?
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 66e4c4d304b0 main.cpp --- /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); + } +}
diff -r 000000000000 -r 66e4c4d304b0 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Feb 16 12:13:02 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/ef9c61f8c49f \ No newline at end of file