Introduction: FRDM K64F - LEDs

In this instructable I'm going to show you how to get started with a FRDM K64F, it is really cool to use it and the programming is quite similar to that of an Arduino.

The K64F is a low power consuming device with a standby current of 150nA usage, it supports drag and drop programming, and has an on board accelerometer and has a lot of GPIO pins.

Here is some technical specification of the board.
High performance ARM® Cortex™-M4 Core with Floating point unit and DSP

  • 120MHz, 256KB RAM, 1MB FLASH
  • USB OTG
  • FXOS8700CQ - 3-axis accelerometer and magnetometer
  • Ethernet
  • 2 push buttons
  • RGB LED
  • Micro SD card slot

In this instructable I'm going to show you how to control a bunch of LEDs as a part of beginners tutorial to get started with the board.

So lets get started......

Step 1: Tools and Components

The components list is as you guess,

  • FRDM K64F
  • LEDs
  • Breadboard
  • 330Ohm Resistor

NO soldering skills are required, as the circuit is assembled on a breadboard.

Step 2: Plugging It In

Now it's time you take the board out of the box and get yourself a micro USB cable. Plug in the USB cable into the Open SDA port. Now the board would flash Red, Blue, Green colors in a loop to you and in your computer, you should see that a mass storage device has been connected with about 1 mb of free space.

The device would be named MBED CMSIS-DAP if you open up your Control Panel => Hardware and Sound => Devices and Printers in Windows PC or just type in lsusb in Linux (It is named NXP LPC1768 in Ubuntu). If the above steps go fine then you have connected your K64F successfully.

Step 3: Registering an Account at Mbed.org

If the previous step went fine now open the mass storage device using a file explorer, the USB storage will be named MBED by default. In the root of the storage you would find a file named mbed.html.
Open up the file in a web browser and you would get redirected to mbed.org where you can register for an account or if you have used it before you can login. After successfully registering you would see your home screen and on the top right corner you would find Compile, click on that to start the online SDK or IDE. The K64F supports a drag and drop interface which I will be explaining shortly.

Step 4: Program and Hardware

The program is quite simple and you can copy paste it form below to the mbed editor.

<p>#include "mbed.h"<br> 
DigitalOut gpo(D0);
DigitalOut led(LED_RED);
 
int main()
{
    while (true) {
        gpo = !gpo; // toggle pin
        led = !led; // toggle led
        wait(1);
    }
}</p>

Once you are done programming compile it and drag and drop the bin file that is downloaded, in the K64F Flash drive. You should see the green light go crazy for a few seconds and then your code has been uploaded.

The code blinks an led at digital pin 0, and also the RBG LED on the board also flashes red color.

Then connect the LEDs anode to digital pin 0 and cathode to the ground terminal. Power on the board, if you programmed the board after connecting the LED you need to hit reset button to get it to start working.

In the next tutorial I'm going to show you how to connect an servo, and talk about programming the K64F. If you have any doubt please leave a comment below, I will be glad to help you out.