FRDM-K64 Interrupt basic example using mbed

Document created by Pedro Augusto Panecatl Salas Employee on Jun 27, 2014Last modified by ebiz_ws_prod on Dec 13, 2017
Version 4Show Document
  • View in full screen mode

Here you can find the code and project files for the Interrupt example, in this example 2 KBI interrupts are enabled, one assigned to SW2 and another to SW3, during the main routine the blue led is turned on, when the interrupt routines are triggered the blue led is turned off and the red or green led blink once, the interrupt was configured to detect falling edges only.

 

Code:

 

#include "mbed.h"

 

 

DigitalOut Red(LED1);

DigitalOut Blue(LED3);

InterruptIn Interrupt(SW2);

 

 

void blink()

{

    wait(.4);

    Red=1;

    Blue=0;

    wait(.4);

    Blue=1;

    wait(.4);

}

 

int main()

{

    Interrupt.fall(&blink);

    Blue=1;

    while (1)

    {

        Red=!Red;

        wait(.4);

    }

}

Original Attachment has been moved to: FRDM-K64_Interrupt_K64F.bin.zip

Original Attachment has been moved to: FRDM-K64_Interrupt_full.zip

Attachments

    Outcomes