Orkhan Amiraslanov
/
PWM_LED
Fading LEDs
Revision 0:e9e7bf4c3d88, committed 2013-09-07
- Comitter:
- condorxan
- Date:
- Sat Sep 07 22:14:29 2013 +0000
- Commit message:
- first_try
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r e9e7bf4c3d88 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Sep 07 22:14:29 2013 +0000 @@ -0,0 +1,67 @@ + +#include "mbed.h" + +PwmOut rate1(LED1); +PwmOut rate2(LED2); +PwmOut rate3(LED3); +PwmOut rate4(LED4); + + +int main() { + +while(1) +{ + for(float p=0; p<1.0; p += 0.01) { + rate1 = p; + wait(0.01); + } + + for(float p=0; p<1.0; p += 0.01) { + rate2 = p; + wait(0.01); + } + + + for(float p=0; p<1.0; p += 0.01) { + rate3 = p; + wait(0.01); + } + + for(float p=0; p<1.0; p += 0.01) { + rate4 = p; + wait(0.01); + } + + + for(float p=1; p>0; p = p- 0.01) { + rate4 = p; + wait(0.01); + } + + for(float p=1; p>0; p = p- 0.01) { + rate3 = p; + wait(0.01); + } + + for(float p=1; p>0; p = p- 0.01) { + rate2 = p; + wait(0.01); + } + + for(float p=1; p>0; p = p- 0.01) { + rate1 = p; + wait(0.01); + } + + + wait(0.1); + } + +} + + + + + + +
diff -r 000000000000 -r e9e7bf4c3d88 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Sep 07 22:14:29 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9c8f0e3462fb \ No newline at end of file