PWM LED Brightness control example for WIZWiki-W7500
Dependencies: mbed
main.cpp@1:6de41d7e14b5, 2017-04-20 (annotated)
- Committer:
- jcm931213
- Date:
- Thu Apr 20 02:17:28 2017 +0000
- Revision:
- 1:6de41d7e14b5
- Parent:
- 0:7ee88984a52b
- Child:
- 2:8b2466c9dce3
create led control example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jcm931213 | 0:7ee88984a52b | 1 | #include "mbed.h" |
jcm931213 | 0:7ee88984a52b | 2 | |
jcm931213 | 0:7ee88984a52b | 3 | |
jcm931213 | 0:7ee88984a52b | 4 | PwmOut pwm0(D3); |
jcm931213 | 0:7ee88984a52b | 5 | PwmOut pwm1(D5); |
jcm931213 | 0:7ee88984a52b | 6 | |
jcm931213 | 0:7ee88984a52b | 7 | |
jcm931213 | 0:7ee88984a52b | 8 | int main(void) |
jcm931213 | 0:7ee88984a52b | 9 | { |
jcm931213 | 0:7ee88984a52b | 10 | int i; |
jcm931213 | 0:7ee88984a52b | 11 | |
jcm931213 | 0:7ee88984a52b | 12 | while(1){ |
jcm931213 | 1:6de41d7e14b5 | 13 | for(i=1000; i>0; i=i-1) { |
jcm931213 | 1:6de41d7e14b5 | 14 | pwm0.write(i*0.001); |
jcm931213 | 1:6de41d7e14b5 | 15 | pwm1.pulsewidth_us(i*100); |
jcm931213 | 1:6de41d7e14b5 | 16 | wait(0.005); |
jcm931213 | 0:7ee88984a52b | 17 | } |
jcm931213 | 0:7ee88984a52b | 18 | } |
jcm931213 | 0:7ee88984a52b | 19 | } |
jcm931213 | 0:7ee88984a52b | 20 |