Light Micro:bit with Mbed
One of the coolest features of the micro:bit is its ability to be programmed with a number of languages:
- Microsoft MakeCode block editor — Similar to Scratch and Blockly, users can drag and drop blocks to create programs. Teachers, especially, have experienced success using block-based programming languages in schools and clubs, including elementary schools.
- MicroPython — MicroPython is a subset of the Python language and was developed specifically for micro-controllers. If you’re not a fan of online editors, I’ve had success with the MU editor for creating MicroPython programs.
- C++ — The micro:bit is Mbed-enabled, which means programs are compiled to a hex file that you copy and paste into the root directory of the micro:bit, which enumerates as a mass storage device on your computer. It’s a pretty seamless and slick process, and if you want to get your hands dirty with C++, you can use the Mbed “Compiler” editor to write code for the micro:bit.
The above passage of micro:bit introduction comes from Sparkfun. You can see more details here: https://www.sparkfun.com/news/2356 A point in this article impressed me most is that we can use C++ to program for micro:bit. However, these days i have searched online again and again but still can not find a case for that. This can be a big problem for those who do not familiar with MicroPython. So i decided to write a blog to show you a case created by my own. Today, i am going to show you how to use Mbed to program “ hello world” for micro:bit. First of all, let’s take a look of what is Mbed.
- What is Mbed?
Mbed is a prototyping development platform for ARM processor. Actually it conclude three parts: free Software Development Kit（SDK）, Hardware Design Kit（HDK）and online tools（Web）. You can see introduction for the three parts below:
SDK：Mbed have designed a hardware abstract level , thus blocked the difference of processors provided by different MCU manufacturers. For users, he/she have to contact with this abstract level only. That means the application of Mbed development enables users to exchange ARM processors provided by different manufacturers very conveniently so that users have more choices.
HDK: HDK is hardware design kit provided by Mbed. It is designed for users to do development. So HDK provides a complete set of program upload interface, solitary debugging interface, and serial debugging interface so that users can develop software without buying other hardware.
WEB：In order to save time of software installation for users, Mbed provides a complete unit of processor development interfaces based on chrome with functions including code editing, program compilation, and version management . Users can develop only if there has web access. Download the code and save into Mbed board, then it will start to run. It is very convenient . To make it simple, Mbed is a development platform. It is a platform based on ARM Cortex-M serial micro-chip development.
- What advantage Mbed owns?
- If you are those who knows a little bit about development, such as you can use C language or Java but not familiar with it and you don’t know much about hardware, then you will learn hardware development with Mbed soon. ( Mbed is so-called online “a tool for you to complete embedded program development within 60 seconds.)
Suppose you are doing prototyping and you have several choices for cores, or you are doing outer components test and study, then your work will become much easier for you have used Mbed. What is the technique of ARM Mbed? Simply speaking, it has two characters. And these characters provide convenience for core providers(or manufacturers) and software developers. The first character is CMSIS. CMSIS is a set of interface framework designated by ARM. It can block differences of cores provided by manufacturers. And for core manufacturers, it have to implement these designated rules of interface only. The second, for developers,to build a development environment is a time-consuming, energy-consuming process. To write and debugging a process successfully is like to give birth a baby which can never be easily and successfully done without suffering a series of struggling and fumbling. And Mbed is a web compiler based on cloud computation. It can do programming on serious of chrome scanning settings like Windows、Linux、Mac etc..Without debugging tools, you can program with designated development board immediately. After completion of program, it will form a Bin file directly. Then you can burn this file into your equipment and make your equipment running. Another advantage is because of users’ development is based on CMSIS, theoretically you can easily and successfully develop cores from different manufacturers, which have provided CMSIS support, instead of head-aching about core exchange. As for IOT developers, with Mbed technique you can easily collect datas from different sensors into Cortex-MO/M3 by AD port, serial ports, SPI, I2C ,USB, CAN or even Ethernet ports. After collection, next important step is to upload these datas. And this step is the technique advantage for the reason why ARM acquire Sensinode.
- Mbed Supported Development Board
At present, on the Mbed website, we can find support platform for development board including STM, Freescale, NXP Semiconductors, Renesas, etc.. And, of course, BBC micro: bit is included too.
- How to use Mbed
ARM Mbed IDE is an online development tool. Here’s the link for it: http://developer.Mbed.org/. This link provides an online compiler.You do not have to install the local compiler and constantly update its version. Besides, it has no time or place limitation. Only if you have web access, then you can develop at any time or anywhere. Next, in the following passages, we are going to show you how to use Mbed to do our first programming for micro:bit. Before we use Mbed, we have to register an account. Then we can start our development under this account. Here’s the ARM Mbed IDE Website：https://developer.Mbed.org/
Log into the website above by clicking “Login or signup”.
Then click “Signup”.
After we have successfully registered an account, log in again and click “Compiler” to visit the program interface.
Next bring in development board platform. Because Mbed supports several platforms. Here we choose Micro:bit and then click the icon on the top right corner of the compiler.
Choose development board platform, and Click “Add Platform”.
Here, we choose BBC micro:bit.
Then click “Add to your Mbed Compiler”
Next, enter online compiler again and we will see we have added the platform.
On right side of“My Programs, click right mouse key to choose “New Program”.
Within “Template”, we can see several cases and we choose the first one to do compiling.
Once we finished compiling, download HEX file into micro:bit storage.
After all steps completed, we can see LED light on the left top corner of micro:bit is flashing.
The power of Mbed lies in its high compatibility and with a complete set of kit easy to use. As for the usage of kit, you can follow up the courses made by us. You can visit our website: www.elecfreaks.com for more interesting blogs.