Testet die RGB
Dependencies: mbed
main.cpp
- Committer:
- winkler_martin
- Date:
- 2015-06-15
- Revision:
- 1:727c55ba9d9f
- Parent:
- 0:28a4d412f331
File content as of revision 1:727c55ba9d9f:
#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 + 5; ledgreen = (100 - green)/100; wait(time); } while(red >= 0) { red = red - 5; ledred = (100 - red)/100; wait(time); } while(blue <= 255) { blue = blue + 5; ledblue = (100 - blue)/100; wait(time); } while(green >= 0) { green = green - 5; ledgreen = (100 - green)/100; wait(time); } while(red <= 255) { red = red + 5; ledred = (100 - red)/100; wait(time); } while(blue >= 0) { blue = blue - 1; ledblue = (100 - blue)/100; wait(time); } } }