Led qui change de couleur

Dependencies:   mbed

main.cpp

Committer:
Wabouz
Date:
2013-05-08
Revision:
0:de23ac5e6daa

File content as of revision 0:de23ac5e6daa:

#include "mbed.h"

PwmOut Red(p23);
PwmOut Green(p24);
PwmOut Blue(p25);

int main()
{
    unsigned char R, G, B;

    Red.period_ms(1);
    Green.period_ms(1);
    Blue.period_ms(1);
    while (1) {
        for (R = 0; R < 100; R++) {
            Red.pulsewidth_ms(R);
            for (G = 0; G < 100; G++) {
                Green.pulsewidth_ms(G);
                for (B = 0; B < 100; B++) {
                    Blue.pulsewidth_ms(B);
                }
            }
        }
    }
}