Leroy levin
Published © GPL3+

Getting Started with NXP FRDM-K64F and the Mbed Environment

This is a getting started guide describing how to use the NXP FRDM-K64F dev board within the online mbed IOT development platform.

IntermediateProtip2 hours3,702
Getting Started with NXP FRDM-K64F and the Mbed Environment

Things used in this project

Hardware components

FRDM Board
NXP FRDM Board
NXP FRDM-K64F
×1

Software apps and online services

ARM mbed Development Community
Multi platform online development environment

Story

Read more

Code

frdm_helloworld

C/C++
The code for the example hello world.
// From the NXP mbed repository at
// https://developer.mbed.org/teams/NXP/code/frdm_helloworld

#include "mbed.h"
 
DigitalOut led_red(LED_RED);
DigitalOut led_green(LED_GREEN);
DigitalIn sw2(SW2);
DigitalIn sw3(SW3);
Serial pc(USBTX, USBRX);
 
void check_sw2(void)
{
    if (sw2 == 0) {
        pc.printf("SW2 button pressed. \n");
        led_red = 0;
        led_green = 1;
    }
}
 
void check_sw3(void)
{
    if (sw3 == 0) {
        pc.printf("SW3 button pressed. \n");
        led_green = 0;
        led_red = 1;
        pc.printf("5 characters will be echoed. Start typing. \n");
        for (uint32_t i = 0; i < 5; i++) {
            pc.putc(pc.getc());
        }
        pc.putc(13); /* CR */
        pc.putc(10); /* LF */
    }
}
 
int main() {
    led_green = 1;
    led_red = 1;
    pc.baud(115200);
    pc.printf("Hello World from FRDM-K64F board.\n");
 
    while (true) {
        check_sw2();
        check_sw3();
        wait(0.3);
    }
}

Credits

Leroy levin
4 projects • 20 followers
Long time software engineer, rebooting my skills into the IOT ecosystem. Learning all I can about sensor, microcontrollers, MEAN stack web.
Contact

Comments

Please log in or sign up to comment.