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.

Dependencies:   mbed

Fork of mbed_blinky by Mbed

Committer:
apluscw
Date:
Mon Nov 24 22:30:21 2014 +0000
Revision:
7:1941b3600fd1
Parent:
4:81cea7a352b0
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.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dan 0:7dec7e9ac085 1 #include "mbed.h"
dan 0:7dec7e9ac085 2
apluscw 7:1941b3600fd1 3 //Map the LED outputs to the tri-color LED
apluscw 7:1941b3600fd1 4 DigitalOut redLed(LED1);
apluscw 7:1941b3600fd1 5 DigitalOut greenLed(LED2);
apluscw 7:1941b3600fd1 6 DigitalOut blueLed(LED3);
apluscw 7:1941b3600fd1 7
apluscw 7:1941b3600fd1 8 //Could be logic low or logic high
apluscw 7:1941b3600fd1 9 #define LED_ON 0
apluscw 7:1941b3600fd1 10 #define LED_OFF 1
dan 0:7dec7e9ac085 11
dan 0:7dec7e9ac085 12 int main() {
apluscw 7:1941b3600fd1 13 redLed = LED_OFF;
apluscw 7:1941b3600fd1 14 greenLed = LED_OFF;
apluscw 7:1941b3600fd1 15 blueLed = LED_OFF;
apluscw 7:1941b3600fd1 16
dan 0:7dec7e9ac085 17 while(1) {
apluscw 7:1941b3600fd1 18 redLed = LED_ON;
apluscw 7:1941b3600fd1 19 wait(1.0);
apluscw 7:1941b3600fd1 20 redLed = LED_OFF;
apluscw 7:1941b3600fd1 21 wait(1.0);
apluscw 7:1941b3600fd1 22 greenLed = LED_ON;
apluscw 7:1941b3600fd1 23 wait(1.0);
apluscw 7:1941b3600fd1 24 greenLed = LED_OFF;
apluscw 7:1941b3600fd1 25 wait(1.0);
apluscw 7:1941b3600fd1 26 blueLed = LED_ON;
apluscw 7:1941b3600fd1 27 wait(1.0);
apluscw 7:1941b3600fd1 28 blueLed = LED_OFF;
apluscw 7:1941b3600fd1 29 wait(1.0);
stevep 4:81cea7a352b0 30 }
dan 0:7dec7e9ac085 31 }