Digital outputs – Turn on a LED

Objective:

Learn to turn on and off a LED from our board.

Step 1. Login

First you need to login into your account (if you haven’t done so yet). Now click on the upper right button “Compiler”

Compiler

And a new window is opened, this is where you are going to write your programs.

compiler_main_screen

In this case I have some programs written before, your’s must be in blank if you are a new user.

Step 2. Add your platform

Once you have entered to the compiler you need to add your developer platform, so clic in the righ upper botton “Add platform”. A new windows opens, select the platform that you have and on the left side theres a button that says “Add to your compiler”.

select_platform

add_to_your_mbed_compiler_button

Step 3. Create a new file

Now that you have your account we need to create a new file. Click on the upper left button “New”.

new_file_button

And it will appear a new window asking for some basic information about your new program.

new_program_window“Platform” refers to the board that you will use to do your project, in this case I’m using the KL25Z. In “Template” section you will find some examples programs or you can select a blank project, leave as is. Finally in “Program Name” you need to define a name for your project, in this case you can leave it with the default name. Press “OK” to continue.

It will appear a window with basic information about the program you just has created. Double click on main.c to open your program file.

blinky_new_program

Step 4. Undestanding the program

This is your first program, in this case you will have the next code into it because we are using a template.

first program

 

Step 5. Program your board

To program your board you need to connect it to your computer using a USB cable. Windows will recognize your microcontroller as a standard USB drive as shown on the next image.

devices

Now on the compiler click on the button “Compile” and your browser will ask you to download a file, save it to a know folder.

Copy and paste this file into your mbed drive, wait some seconds and press the reset button to run your program.

A red Led should be blinking now.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s