HelloWorld Blinky Program
Dependencies: mbed
Fork of LPCX824_blinky_v1 by
main.cpp@0:ff88e3980956, 2014-12-07 (annotated)
- Committer:
- rcflyair
- Date:
- Sun Dec 07 07:13:55 2014 +0000
- Revision:
- 0:ff88e3980956
Just got this board and couldn't find any sample code for it! Here's a simple helloworld blinky.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rcflyair | 0:ff88e3980956 | 1 | #include "mbed.h" |
rcflyair | 0:ff88e3980956 | 2 | |
rcflyair | 0:ff88e3980956 | 3 | // LPCXpresso 824-MAX |
rcflyair | 0:ff88e3980956 | 4 | // Blinky hello world program will light red, green, blue led in sequence |
rcflyair | 0:ff88e3980956 | 5 | |
rcflyair | 0:ff88e3980956 | 6 | DigitalOut r(P0_12); |
rcflyair | 0:ff88e3980956 | 7 | DigitalOut g(P0_16); |
rcflyair | 0:ff88e3980956 | 8 | DigitalOut b(P0_27); |
rcflyair | 0:ff88e3980956 | 9 | |
rcflyair | 0:ff88e3980956 | 10 | int main(void) |
rcflyair | 0:ff88e3980956 | 11 | { |
rcflyair | 0:ff88e3980956 | 12 | // turn off all led's |
rcflyair | 0:ff88e3980956 | 13 | r = 1; g = 1; b = 1; |
rcflyair | 0:ff88e3980956 | 14 | |
rcflyair | 0:ff88e3980956 | 15 | while(1) |
rcflyair | 0:ff88e3980956 | 16 | { |
rcflyair | 0:ff88e3980956 | 17 | r = 0; |
rcflyair | 0:ff88e3980956 | 18 | wait_ms(250); |
rcflyair | 0:ff88e3980956 | 19 | r = 1; |
rcflyair | 0:ff88e3980956 | 20 | wait_ms(250); |
rcflyair | 0:ff88e3980956 | 21 | g = 0; |
rcflyair | 0:ff88e3980956 | 22 | wait_ms(250); |
rcflyair | 0:ff88e3980956 | 23 | g = 1; |
rcflyair | 0:ff88e3980956 | 24 | wait_ms(250); |
rcflyair | 0:ff88e3980956 | 25 | b = 0; |
rcflyair | 0:ff88e3980956 | 26 | wait_ms(250); |
rcflyair | 0:ff88e3980956 | 27 | b = 1; |
rcflyair | 0:ff88e3980956 | 28 | wait_ms(250); |
rcflyair | 0:ff88e3980956 | 29 | } |
rcflyair | 0:ff88e3980956 | 30 | } |