![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
PWM + RGB code example for FRDM-KL25Z
Diff: main.cpp
- Revision:
- 0:cb11ef198767
diff -r 000000000000 -r cb11ef198767 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jun 04 19:25:10 2014 +0000 @@ -0,0 +1,27 @@ +#include "mbed.h" + +PwmOut Red(LED_RED); +//PwmOut Green(LED_GREEN); + + + +int main() +{ + Red.period_ms(2000); + // Green.period(1000); + // Red.pulsewidth_ms(500); + int x; + x=1; + + while(1) + { + Red.pulsewidth_ms(x); + x=x+2; + wait(1); + if(x==1000) + { + x=1; + } + } + +} \ No newline at end of file