EmbeddedAdvantage / Mbed OS LED_and_GPIO_Interrupt_example_for_K64F

You are viewing an older revision! See the latest version

Homepage

Getting started with "LED_and_Interrupt_example_for_K64F"

Author: SGSPECKER (www.mindshareadvantage.com)

Abstract

This program was written as a relatively simple code example showing users how to use the switches (i.e. push buttons) and the tri-color LED on the FRDM-64F development board.

Description

This is a simple program which demonstrates using GPIO outputs to drive the tri-color LED on the FRDM-K64F development board.

SW2: Switch 2 is used to toggle the blinking LED on/off SW3: Switch 3 is used to toggle the color for the LED

The switches are handled via interrupts. Whenever a switch is pushed, it triggers a down (and up) interrupts. Callback functions are registered with the mbed OS to handle these interrupts. This program only makes use of the falling interrupt condition. We configure but don't utilize the rising condition of the button switches. Note that the SW2 and SW3 switch names are defined by the mbed OS for the FRDM-K64F

The following LED values are defined by the mbed OS for the FRDM-K64F. The symbols represent the GPIO pins that are tied to the tri-color LED.

LED_RED LED_GREEN LED_BLUE

The tri-color (Red, Green, Blue) LED is managed by the "myLeds" source files (myLeds.h, myLeds.cpp) added to this project. While not separating this code is not required, allows us to quickly add this functionality to this, and any other, project.

While seven LED colors are defined in myLeds.cpp, only 5 of them are used in main.cpp.

The serial port is used to communicate with your computer in order to send status and debug information. The serial port is configured with the default settings, which means it runs at 9600 baud.


All wikipages