Blink an LED - embedded version of HelloWorld

Dependencies:   mbed

Fork of HelloWorld by Simon Ford

You are viewing an older revision! See the latest version

Homepage

What Does It Do?

Just blink an LED - the embedded version of the classic beginners' program Hello World.

The source code can be viewed at the bottom of this page by clicking on main.cpp.

However, the easiest way to use the code is to click on Import into Compiler from the Repository Toolbox on the right, as shown in the screen capture below:
/media/uploads/cputalk/repository-toolbox-3.gif
This loads a copy of the code into your online compiler. Click on Compile and in a few seconds your will have compiled your own Hello World!

By the way, edit and experiment as much as you want, because you cannot mess anything up - you can come back here any time and import again for a fresh copy.

This code is identical to Simon Ford's /teams/mbed/code/mbed_blinky/ and ST's /teams/ST/code/Nucleo_blink_led/ except that this source contains a few extra comment lines.

Library Information

The mbed library used by this code is currently /users/mbed_official/code/mbed/rev/093f2bd7b9eb, which is revision 138 of the official mbed 2 library. Revision 138 was released on March 14, 2017. You can see this for yourself by inspecting the contents of the mbed.bld file /users/cputalk/code/HelloWorld/file/1e30337600e4/mbed.bld which points to the associated mbed library.

The library is automatically imported when you import this code into your online editor - in general you don't need to do anything special.

Library Source Code

One of the coollest features of mbed is that the library source code is freely available.

You can view the library source code here https://developer.mbed.org/users/mbed_official/code/mbed-dev/.

If Your Compile Fails

If your compile fails, it's most likely that you are using brand new hardware that was not yet included when revision 138 of the mbed library was released. In that case, update to the latest library. (see below)

Updating to the Latest mbed Library

In your online compiler, click on "mbed" in your Program Workspace, as in the picture below:

/media/uploads/cputalk/mbed-lib.gif

Then, on the right side of your screen, under Library Build Details, click on Update, as seen in the picture below:

/media/uploads/cputalk/lib-build-details.gif

Notice how the Status line in the Library Build Details window (above) actually tells you new version available.

I will attempt to update the code to use the latest mbed library version regularly.
The latest update was on 3/23/2017 to revision 138 - see https://mbed.org/users/mbed_official/code/mbed/builds/093f2bd7b9eb


All wikipages