Carlos Quintana
/
frdm_gpioPruebas
PTA2 como salida PWM para variar la intensidad de un led. No funciona en los pines del RGB LED
Revision 0:5d0256c83f87, committed 2018-12-16
- Comitter:
- Otakutronics
- Date:
- Sun Dec 16 23:26:01 2018 +0000
- Commit message:
- PTA2 como salida PWM
Changed in this revision
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
pwm.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Dec 16 23:26:01 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pwm.cpp Sun Dec 16 23:26:01 2018 +0000 @@ -0,0 +1,20 @@ +#include "mbed.h" + +DigitalOut gpo(D0); +DigitalOut led(LED_BLUE,1); +PwmOut rojo(PTA2); +//>< +int main() +{ + float i; + rojo.period_ms(100); + while(1){ + for (i=1.0f;i>0.0f;i=i-0.0025f){ + rojo.write(i); + wait_ms(25); + } + } + // gpo = !gpo; // toggle pin + // led = !led; // toggle led + // wait(0.2f); +} \ No newline at end of file