Try to use digitalIn and pwm on the same pin. It is not work

Dependencies:   mbed

main.cpp

Committer:
acos
Date:
2017-02-16
Revision:
0:66e4c4d304b0

File content as of revision 0:66e4c4d304b0:

#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);
    }
}