RGB color LCD Test (PWM) for BlackOne

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 //DigitalOut myled(LED1);
00004 PwmOut blue(p24);
00005 PwmOut green(p25);
00006 PwmOut red(p26);
00007 
00008 int main() {
00009     while(1) {
00010         for(float p = 0.0f; p < 1.0f; p += 0.05f) {
00011             blue = p;
00012             green = 1 - p;
00013             wait(0.04);
00014         }
00015         for(float p = 0.0f; p < 1.0f; p += 0.05f) {
00016             red = p;
00017             blue = 1 - p;
00018             wait(0.04);
00019         }
00020         for(float p = 0.0f; p < 1.0f; p += 0.05f) {
00021             green = p;
00022             red = 1 - p;
00023             wait(0.04);
00024         }
00025     }
00026 }