Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 2:073d39b53874
- Parent:
- 0:4860a91fb495
- Child:
- 3:f057c1dbef0a
--- a/main.cpp Mon Feb 17 22:16:24 2014 +0000 +++ b/main.cpp Fri Feb 20 17:02:50 2015 +0000 @@ -1,18 +1,15 @@ #include "mbed.h" -PwmOut mypwm(PWM_OUT); - -DigitalOut myled(LED1); +PwmOut mypwm(PA_5); +int pulse_per = 10; int main() { - - mypwm.period_ms(10); - mypwm.pulsewidth_ms(1); + +for(int i = 0, i < pulse_per, i++){ + mypwm.period_ms(pulse_per); + mypwm.pulsewidth_ms(i); printf("pwm set to %.2f %%\n", mypwm.read() * 100); - - while(1) { - myled = !myled; - wait(1); } + }