Testet die RGB
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:28a4d412f331
- Child:
- 1:727c55ba9d9f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 28 09:55:29 2015 +0000 @@ -0,0 +1,50 @@ +#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); + + } + } +} \ No newline at end of file