Maps the mbed LEDs to the K22F tricolor LEDs and demonstrates a simple blink sequence. Tested on K22F but may well work on other FRDM boards.
Fork of mbed_blinky by
Revision 7:1941b3600fd1, committed 2014-11-24
- Comitter:
- apluscw
- Date:
- Mon Nov 24 22:30:21 2014 +0000
- Parent:
- 6:e8cd76f38fa9
- Commit message:
- Simple, but good working code. Shows mapping between the LEDs and the tricolor LED on the K22F board. Would suspect other FRDM boards would be identical.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r e8cd76f38fa9 -r 1941b3600fd1 main.cpp --- a/main.cpp Fri May 09 19:58:03 2014 +0300 +++ b/main.cpp Mon Nov 24 22:30:21 2014 +0000 @@ -1,12 +1,31 @@ #include "mbed.h" -DigitalOut myled(LED1); +//Map the LED outputs to the tri-color LED +DigitalOut redLed(LED1); +DigitalOut greenLed(LED2); +DigitalOut blueLed(LED3); + +//Could be logic low or logic high +#define LED_ON 0 +#define LED_OFF 1 int main() { + redLed = LED_OFF; + greenLed = LED_OFF; + blueLed = LED_OFF; + while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); + redLed = LED_ON; + wait(1.0); + redLed = LED_OFF; + wait(1.0); + greenLed = LED_ON; + wait(1.0); + greenLed = LED_OFF; + wait(1.0); + blueLed = LED_ON; + wait(1.0); + blueLed = LED_OFF; + wait(1.0); } }
diff -r e8cd76f38fa9 -r 1941b3600fd1 mbed.bld --- a/mbed.bld Fri May 09 19:58:03 2014 +0300 +++ b/mbed.bld Mon Nov 24 22:30:21 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89 \ No newline at end of file