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.
Fork of Task136 by
main.cpp@0:6637f9cf2dc0, 2015-09-29 (annotated)
- Committer:
- noutram
- Date:
- Tue Sep 29 11:18:49 2015 +0000
- Revision:
- 0:6637f9cf2dc0
- Child:
- 2:12fb933ccc6d
Initial version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
noutram | 0:6637f9cf2dc0 | 1 | #include "mbed.h" |
noutram | 0:6637f9cf2dc0 | 2 | |
noutram | 0:6637f9cf2dc0 | 3 | PwmOut mypwm(PWM_OUT); |
noutram | 0:6637f9cf2dc0 | 4 | |
noutram | 0:6637f9cf2dc0 | 5 | DigitalOut myled(LED1); |
noutram | 0:6637f9cf2dc0 | 6 | |
noutram | 0:6637f9cf2dc0 | 7 | int main() { |
noutram | 0:6637f9cf2dc0 | 8 | |
noutram | 0:6637f9cf2dc0 | 9 | mypwm.period_ms(10); |
noutram | 0:6637f9cf2dc0 | 10 | mypwm.pulsewidth_ms(1); |
noutram | 0:6637f9cf2dc0 | 11 | |
noutram | 0:6637f9cf2dc0 | 12 | printf("pwm set to %.2f %%\n", mypwm.read() * 100); |
noutram | 0:6637f9cf2dc0 | 13 | |
noutram | 0:6637f9cf2dc0 | 14 | while(1) { |
noutram | 0:6637f9cf2dc0 | 15 | myled = !myled; |
noutram | 0:6637f9cf2dc0 | 16 | wait(1); |
noutram | 0:6637f9cf2dc0 | 17 | } |
noutram | 0:6637f9cf2dc0 | 18 | } |