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.
main.cpp@3:f057c1dbef0a, 2015-02-20 (annotated)
- Committer:
- Calamaro
- Date:
- Fri Feb 20 17:14:01 2015 +0000
- Revision:
- 3:f057c1dbef0a
- Parent:
- 2:073d39b53874
introducted fading on LED2;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 0:4860a91fb495 | 1 | #include "mbed.h" |
bcostm | 0:4860a91fb495 | 2 | |
Calamaro | 2:073d39b53874 | 3 | PwmOut mypwm(PA_5); |
Calamaro | 3:f057c1dbef0a | 4 | int pulse_per = 100; |
Calamaro | 2:073d39b53874 | 5 | |
Calamaro | 3:f057c1dbef0a | 6 | int main() |
Calamaro | 3:f057c1dbef0a | 7 | { |
Calamaro | 3:f057c1dbef0a | 8 | while(1) { |
Calamaro | 3:f057c1dbef0a | 9 | for(int i = 0; i < pulse_per; i++) { |
Calamaro | 3:f057c1dbef0a | 10 | mypwm.period_us(pulse_per); |
Calamaro | 3:f057c1dbef0a | 11 | mypwm.pulsewidth_us(i); |
Calamaro | 3:f057c1dbef0a | 12 | wait(0.01); |
Calamaro | 3:f057c1dbef0a | 13 | } |
Calamaro | 3:f057c1dbef0a | 14 | for(int i = pulse_per; i > 0; i--) { |
Calamaro | 3:f057c1dbef0a | 15 | mypwm.period_us(pulse_per); |
Calamaro | 3:f057c1dbef0a | 16 | mypwm.pulsewidth_us(i); |
Calamaro | 3:f057c1dbef0a | 17 | wait(0.01); |
Calamaro | 3:f057c1dbef0a | 18 | } |
Calamaro | 3:f057c1dbef0a | 19 | |
bcostm | 0:4860a91fb495 | 20 | } |
bcostm | 0:4860a91fb495 | 21 | } |