Gabriel Arellano
/
PWM_LEDs
Encendido y regulado de LEDs via PWM.
Revision 0:b128bbb35377, committed 2014-10-07
- Comitter:
- AreTchE
- Date:
- Tue Oct 07 22:26:26 2014 +0000
- Commit message:
- Versi?n inicial
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 07 22:26:26 2014 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" + +PwmOut rled(LED_RED); +PwmOut gled(LED_GREEN); +PwmOut bled(LED_BLUE); + +int main() { + rled = gled = bled = 1; + while(1) { + for(float i=0.0; i<=1.0; i+=0.005) { + rled = i; + wait(0.01); + } + for(float i=0.0; i<=1.0; i+=0.005) { + gled = i; + wait(0.01); + } + for(float i=0.0; i<=1.0; i+=0.005) { + bled = i; + wait(0.01); + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 07 22:26:26 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1 \ No newline at end of file