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.
Dependencies: mbed
main.cpp@0:d0a183ba50d5, 2018-11-08 (annotated)
- Committer:
- CharlesBl
- Date:
- Thu Nov 08 09:54:50 2018 +0000
- Revision:
- 0:d0a183ba50d5
- Child:
- 1:b667efac1cae
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
CharlesBl | 0:d0a183ba50d5 | 1 | #include "mbed.h" |
CharlesBl | 0:d0a183ba50d5 | 2 | |
CharlesBl | 0:d0a183ba50d5 | 3 | PwmOut mypwm(PWM_OUT); |
CharlesBl | 0:d0a183ba50d5 | 4 | |
CharlesBl | 0:d0a183ba50d5 | 5 | DigitalOut myled(LED1); |
CharlesBl | 0:d0a183ba50d5 | 6 | |
CharlesBl | 0:d0a183ba50d5 | 7 | int main() { |
CharlesBl | 0:d0a183ba50d5 | 8 | |
CharlesBl | 0:d0a183ba50d5 | 9 | mypwm.period_ms(10); |
CharlesBl | 0:d0a183ba50d5 | 10 | mypwm.pulsewidth_ms(1); |
CharlesBl | 0:d0a183ba50d5 | 11 | |
CharlesBl | 0:d0a183ba50d5 | 12 | printf("pwm set to %.2f %%\n", mypwm.read() * 100); |
CharlesBl | 0:d0a183ba50d5 | 13 | |
CharlesBl | 0:d0a183ba50d5 | 14 | while(1) { |
CharlesBl | 0:d0a183ba50d5 | 15 | myled = !myled; |
CharlesBl | 0:d0a183ba50d5 | 16 | wait(1); |
CharlesBl | 0:d0a183ba50d5 | 17 | } |
CharlesBl | 0:d0a183ba50d5 | 18 | } |