Testet die RGB

Dependencies:   mbed

main.cpp

Committer:
lukas__27
Date:
2015-05-28
Revision:
0:28a4d412f331
Child:
1:727c55ba9d9f

File content as of revision 0:28a4d412f331:

#include "mbed.h"

PwmOut ledblue (p25);
PwmOut ledgreen (p26);
PwmOut ledred (p14);
int main()
{
    //double max = 170;
    double red = 255;
    double green = 0;
    double blue = 0;
    ledblue = 1;
    ledred = (100 - red)/100;
    ledgreen = 1;
    double time = 0.1;
    while(1) {

        while(green <= 255) {
            green = green + 1;
            ledgreen = (100 - green)/100;
            wait(time);
        }
        while(red >= 0) {
            red = red - 1;
            ledred = (100 - red)/100;
            wait(time);
        }
        while(blue <= 255) {
            blue = blue + 1;
            ledblue = (100 - blue)/100;
            wait(time);
        }
        while(green >= 0) {
            green = green - 1;
            ledgreen = (100 - green)/100;
            wait(time);
        }
        while(red <= 255) {
            red = red + 1;
            ledred = (100 - red)/100;
            wait(time);
        }
        while(blue >= 0) {
            blue = blue - 1;
            ledblue = (100 - blue)/100;
            wait(time);

        }
    }
}