1. I have tried many times to understand PWM function in mbed this week. Only to blink the LED by PWM in 60Hz, which turning to be very simple. As follows,
#include "mbed.h" PwmOut mypwm(LED1); int main() { mypwm.period_ms(1000); mypwm=0.2; while(1) { } }
2. PwmOut function packs many process of PWM output from clock setting, interrupt triggering. But all these is transparent to developers. It takes me long time to find out that the PWM starts when PinName is assigned to PwmOut. It runs on 50Hz and 0.5 Duty circle.
The rest codes only redefine the parameters.
Furthermore, the following two lines are equal in results.
mypwm=0.2;
and mypwm.write(0.2);
3. It is too easy to use but it takes time to find out what happens.