teste com PWM - aula 02/05/2016

Dependencies:   mbed

main.cpp

Committer:
guilhermepaulino
Date:
2016-05-02
Revision:
0:b57d71e51a71

File content as of revision 0:b57d71e51a71:

#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);
        }
    }
}