Robert Schwien
/
LPCXpresso1549_RGB_LED
Just an simple example of mixing the RGB LED on a LPCXpresso1549 board.
main.cpp@0:7dabac24ca0a, 2016-03-09 (annotated)
- Committer:
- ChevelleRob
- Date:
- Wed Mar 09 08:29:37 2016 +0000
- Revision:
- 0:7dabac24ca0a
Just an simple example of mixing the RGB LED on a LPCXpresso1549 board.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ChevelleRob | 0:7dabac24ca0a | 1 | /* |
ChevelleRob | 0:7dabac24ca0a | 2 | **Just an simple example of mixing the |
ChevelleRob | 0:7dabac24ca0a | 3 | **RGB LED on a LPCXpresso1549 board. Do whatever you want with this. |
ChevelleRob | 0:7dabac24ca0a | 4 | */ |
ChevelleRob | 0:7dabac24ca0a | 5 | |
ChevelleRob | 0:7dabac24ca0a | 6 | #include "mbed.h" |
ChevelleRob | 0:7dabac24ca0a | 7 | |
ChevelleRob | 0:7dabac24ca0a | 8 | DigitalOut RedLed(LED1); //You could call them what you want as long as they match |
ChevelleRob | 0:7dabac24ca0a | 9 | DigitalOut GreLed(LED2); //the rest of your program. ie: GreenLED(LED2) or goLED(LED2) etc. |
ChevelleRob | 0:7dabac24ca0a | 10 | DigitalOut BluLed(LED3); |
ChevelleRob | 0:7dabac24ca0a | 11 | |
ChevelleRob | 0:7dabac24ca0a | 12 | int main() |
ChevelleRob | 0:7dabac24ca0a | 13 | { |
ChevelleRob | 0:7dabac24ca0a | 14 | while(1) |
ChevelleRob | 0:7dabac24ca0a | 15 | { |
ChevelleRob | 0:7dabac24ca0a | 16 | // off |
ChevelleRob | 0:7dabac24ca0a | 17 | RedLed = 1; //red off 1 off |
ChevelleRob | 0:7dabac24ca0a | 18 | GreLed = 1; //green off |
ChevelleRob | 0:7dabac24ca0a | 19 | BluLed = 1; //blue off |
ChevelleRob | 0:7dabac24ca0a | 20 | wait(1.0); //1 sec delay |
ChevelleRob | 0:7dabac24ca0a | 21 | |
ChevelleRob | 0:7dabac24ca0a | 22 | // light blue |
ChevelleRob | 0:7dabac24ca0a | 23 | RedLed = 1; //red off |
ChevelleRob | 0:7dabac24ca0a | 24 | GreLed = 0; //green on |
ChevelleRob | 0:7dabac24ca0a | 25 | BluLed = 0; //blue on |
ChevelleRob | 0:7dabac24ca0a | 26 | wait(1.0); //1 sec delay |
ChevelleRob | 0:7dabac24ca0a | 27 | |
ChevelleRob | 0:7dabac24ca0a | 28 | // violet |
ChevelleRob | 0:7dabac24ca0a | 29 | RedLed = 0; //red on |
ChevelleRob | 0:7dabac24ca0a | 30 | GreLed = 1; //green off |
ChevelleRob | 0:7dabac24ca0a | 31 | BluLed = 0; //blue on |
ChevelleRob | 0:7dabac24ca0a | 32 | wait(1.0); //1 sec delay |
ChevelleRob | 0:7dabac24ca0a | 33 | |
ChevelleRob | 0:7dabac24ca0a | 34 | // blue |
ChevelleRob | 0:7dabac24ca0a | 35 | RedLed = 1; //red off |
ChevelleRob | 0:7dabac24ca0a | 36 | GreLed = 1; //green off |
ChevelleRob | 0:7dabac24ca0a | 37 | BluLed = 0; //blue on |
ChevelleRob | 0:7dabac24ca0a | 38 | wait(1.0); //1 sec delay |
ChevelleRob | 0:7dabac24ca0a | 39 | |
ChevelleRob | 0:7dabac24ca0a | 40 | // yellow |
ChevelleRob | 0:7dabac24ca0a | 41 | RedLed = 0; //red on |
ChevelleRob | 0:7dabac24ca0a | 42 | GreLed = 0; //green on |
ChevelleRob | 0:7dabac24ca0a | 43 | BluLed = 1; //blue off |
ChevelleRob | 0:7dabac24ca0a | 44 | wait(1.0); //1 sec delay |
ChevelleRob | 0:7dabac24ca0a | 45 | |
ChevelleRob | 0:7dabac24ca0a | 46 | // green |
ChevelleRob | 0:7dabac24ca0a | 47 | RedLed = 1; //red off |
ChevelleRob | 0:7dabac24ca0a | 48 | GreLed = 0; //green on |
ChevelleRob | 0:7dabac24ca0a | 49 | BluLed = 1; //blue off |
ChevelleRob | 0:7dabac24ca0a | 50 | wait(1.0); //1 sec delay |
ChevelleRob | 0:7dabac24ca0a | 51 | |
ChevelleRob | 0:7dabac24ca0a | 52 | // red |
ChevelleRob | 0:7dabac24ca0a | 53 | RedLed = 0; //red on |
ChevelleRob | 0:7dabac24ca0a | 54 | GreLed = 1; //green off |
ChevelleRob | 0:7dabac24ca0a | 55 | BluLed = 1; //blue off |
ChevelleRob | 0:7dabac24ca0a | 56 | wait(1.0); //1 sec delay |
ChevelleRob | 0:7dabac24ca0a | 57 | } |
ChevelleRob | 0:7dabac24ca0a | 58 | } |