This is my first mbed program for the Kinetis K64F Freedom board.
Dependencies: mbed
Fork of k46f_blink by
main.cpp@0:a4420c888977, 2014-05-08 (annotated)
- Committer:
- rcflyair
- Date:
- Thu May 08 15:09:20 2014 +0000
- Revision:
- 0:a4420c888977
My first mbed program for the Kinetis K64F Freedom board.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rcflyair | 0:a4420c888977 | 1 | #include "mbed.h" |
rcflyair | 0:a4420c888977 | 2 | |
rcflyair | 0:a4420c888977 | 3 | int main() { |
rcflyair | 0:a4420c888977 | 4 | DigitalOut RLED(PTB22); |
rcflyair | 0:a4420c888977 | 5 | DigitalOut GLED(PTE26); |
rcflyair | 0:a4420c888977 | 6 | DigitalOut BLED(PTB21); |
rcflyair | 0:a4420c888977 | 7 | enum color {none, red, green, blue}; |
rcflyair | 0:a4420c888977 | 8 | color state = none; |
rcflyair | 0:a4420c888977 | 9 | |
rcflyair | 0:a4420c888977 | 10 | while (true) { |
rcflyair | 0:a4420c888977 | 11 | switch (state) { |
rcflyair | 0:a4420c888977 | 12 | case none : |
rcflyair | 0:a4420c888977 | 13 | RLED = 1; |
rcflyair | 0:a4420c888977 | 14 | GLED = 1; |
rcflyair | 0:a4420c888977 | 15 | BLED = 1; |
rcflyair | 0:a4420c888977 | 16 | state = red; |
rcflyair | 0:a4420c888977 | 17 | break; |
rcflyair | 0:a4420c888977 | 18 | case red : |
rcflyair | 0:a4420c888977 | 19 | RLED = 0; |
rcflyair | 0:a4420c888977 | 20 | GLED = 1; |
rcflyair | 0:a4420c888977 | 21 | BLED = 1; |
rcflyair | 0:a4420c888977 | 22 | state = green; |
rcflyair | 0:a4420c888977 | 23 | break; |
rcflyair | 0:a4420c888977 | 24 | case green : |
rcflyair | 0:a4420c888977 | 25 | RLED = 1; |
rcflyair | 0:a4420c888977 | 26 | GLED = 0; |
rcflyair | 0:a4420c888977 | 27 | BLED = 1; |
rcflyair | 0:a4420c888977 | 28 | state = blue; |
rcflyair | 0:a4420c888977 | 29 | break; |
rcflyair | 0:a4420c888977 | 30 | case blue : |
rcflyair | 0:a4420c888977 | 31 | RLED = 1; |
rcflyair | 0:a4420c888977 | 32 | GLED = 1; |
rcflyair | 0:a4420c888977 | 33 | BLED = 0; |
rcflyair | 0:a4420c888977 | 34 | state = red; |
rcflyair | 0:a4420c888977 | 35 | break; |
rcflyair | 0:a4420c888977 | 36 | } |
rcflyair | 0:a4420c888977 | 37 | wait(1); |
rcflyair | 0:a4420c888977 | 38 | } |
rcflyair | 0:a4420c888977 | 39 | } |