Dependencies:   mbed

main.cpp

Committer:
contechno
Date:
2019-10-09
Revision:
0:7f5c273fe35a

File content as of revision 0:7f5c273fe35a:

#include "mbed.h"

DigitalOut red(LED1); //red
DigitalOut green(LED2); //Green
DigitalOut blue(LED3); //Blue

int main() {
    
    // Reset all LEDs to off (LEDs are low-active)
    red = 1;
    green = 1;
    blue = 1;
    
    while(1) {        
        
        //light red LED 1s
        red = 0;
        wait(1);
        red = 1;
        
        //light green LED 1s
        green = 0;
        wait(1);
        green = 1;
        
        //light blue LED 1s
        blue = 0;
        wait(1);
        blue = 1;
        
        //light red and green (=yellow) LEDs 1s
        red = 0;
        green = 0;
        wait(1);
        red = 1;
        green = 1;
        
        //light red and blue (=magenta) LEDs 1s
        red = 0;
        blue = 0;
        wait(1);
        red = 1;
        blue = 1;
        
        //light blue and green (=cyan) LEDs 1s
        blue = 0;
        green = 0;
        wait(1);
        blue = 1;
        green = 1;
    }
}