teste com PWM - aula 02/05/2016
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:b57d71e51a71
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon May 02 18:09:10 2016 +0000 @@ -0,0 +1,27 @@ +#include "mbed.h" +PwmOut ledr(LED1); +PwmOut ledg(LED2); +PwmOut ledb(LED3); + +int main(){ + float p; + while(1){ + ledr=1; + ledg=1; + ledb=1; + for(p=0.0f; p < 0.33f; p += 0.01f){ + ledg=p; + wait(0.02); + } + ledg=1; + for(p=0.33f; p < 0.66f; p += 0.01f){ + ledr=p; + wait(0.02); + } + ledr=1; + for(p=0.66f; p <= 1.0f; p += 0.01f){ + ledb=p; + wait(0.02); + } + } +} \ No newline at end of file