Mbed Introduction
Mbed Introduction
Introduction:
The mbed is an embedded development system based on the 32 bit ARM Cortex 32-bit Cortex-M3 microcontroller. It is designed to help facilitate the rapid development of embedded electronics applications through powerful computing capabilities combined with an easy-to-use software easy use environment thats readily accessible on any computer. Very few (if any) tutorials on the mbed device exist at the time of this writing, however, so we here at NBitWonder have taken the liberty of writing one NBitWonder of the first official mbed tutorials in the hopes that you will find it useful and get out there and start making awesome things with it! In this tutorial, we will interface the mbed to the computer, download a simple program, and then learn how to use the online compiler and write a simple program for the mbed. imple
Disclaimer:
The contents of this tutorial are made freely available for public use under a Creative Commons Attribution 3.0 License. For more information on this license, please refer to informatio http://creativecommons.org/licenses/by/3.0. http://creativecommons.org/licenses/by/3.0. The purpose of these tutorials is to be informative and, hopefully, fun. These tutorials are written and tested to ensure that they can be performed in a safe, non ensure nondestructive manner. To that end, NBitWonder and the author will not be held accountable for any incident of injury, death, or property destruction resulting from improper use of the instructions contained within this tutorial. Be as safe as you are smart, have fun, and we will make it through the tutorial with no unfortunate mishaps.
Pinout/info cards
Tutorial: Introduction to the mbed To interface the mbed to the computer, insert the USB cable into the miniUSB socket. Upon connecting the mbed, it should show up as a flash drive on your computer. If the mbed programmer does not appear on your computer, make sure the USB cable is plugged all the way in and try again. Additionally, Windows occasionally has trouble seeing new drives right away, so hitting F5 in an explorer window may be a useful fix. For any other problems, contact mbed support at [email protected].
Going Online:
Once the mbed is connected to the computer, navigate to the mbed drive and open the MBED.htm file located in the drive.
Fig 2. mbed Drive Contents Opening this file brings up the webpage shown below:
_______________________________________________________________________________________ http://nbitwonder.com 2
Tutorial: Introduction to the mbed If you havent already, go ahead and create an account. Once you have created an account or logged in to an existing account, you will be taken to the webpage shown below:
Fig 5. HelloWorld icon Click on this icon to download the HelloWorld binary file to your computer. Then, if it isnt already there, copy or move the file to your mbed drive. The blue led indicator light near the USB port should flash while the file is being copied. With the file saved to your mbed, hit the reset button on the mbed board. Upon doing so, a single blue led should begin to flash. Congratulations, you have successfully run your first program on the mbed system!
Fig 7. mbed Compiler Window Now, right click the My Programs icon and select New Program. A window will pop up asking you to enter project information. I named my project Counter, but feel free to name yours whatever you want. Upon creating the project, a new named project will appear, containing the main.cpp and mbed.h files. The created main.cpp file should contain all of the code necessary to implement the HelloWorld program and is shown in figure 8.
The main.cpp begins with an include statement that includes the mbed header file. After this is a pin assignment created using the DigitalOut function, which is a function from a library of the same name used to create a digital output pin. For more information about the mbed libraries and their functions, select the mbed documentation file (located just below main.cpp in this example) and select an mbed library to learn more about the functions available in that library. After the pin assignment statement is the main loop of the program, written in C++. The mbed compiler supports C++ syntax and constructs within any of its code and also allows standard C++ libraries to be included and used in addition to the specialized mbed libraries.
Additional resources, links, and code related to this tutorial can be found at http://nbitwonder.com/tutorials/microcontrollers/mbed/introduction.
Conclusion:
In this tutorial, we were introduced to the mbed embedded development system and downloaded our first program. Then, we became more familiar with the mbed compiler, writing a simpler binary counter program. We here at NBitWonder hope you have enjoyed this first foray into the world of 32-bit microcontroller development and that you will join us for subsequent tutorials as we delve deeper into the mbed and other microcontroller architectures. Code for the mbed published by NBitWonder can be found at http://mbed.org/users/nbitwonder/ and http://mbed.org/users/benbitwonder/, and you can always receive the latest information and news on NBitWonder at our website, http://nbitwonder.com.
Sources Cited:
mbed Setup Guide, November 2009. [Online]. Available: http://mbed.org/handbook/Setup. [Accessed February 16th, 2010]. Downloading a Program, November 2009. [Online]. Available: http://mbed.org/handbook/MicrocontrollerGettingStarted. [Accessed February 16th, 2010] Getting Started Compiling a Program, November 2009. [Online]. Available: http://mbed.org/handbook/CompilerGettingStarted. [Accessed February 16th, 2010].
_______________________________________________________________________________________ http://nbitwonder.com 6