Earn Maker Points on Every Order! Learn More!

Powering up the Microbit and Start Coding

Back to Blog
Powering up the Microbit and Start Coding - Powering up the Microbit and Start Coding - Powering up the Microbit and Start Coding - Powering up the Microbit and Start Coding

Powering up the Microbit and Start Coding

In this topic, we will see how to power up the microbit and start coding. Microbit provides two ways to powering it up either via USB Cable or via a battery pack. The USB cable is a micro-USB and it can also be used to flash the HEX Code. HEX Code is a machine understandable code from the program you created.

As we know that microbit can be programmed in different programming languages like Microsoft Block editor, JavaScript and Python. The easier method is with the block editor. It has drag and drop options to program it fast and easily understandable for kids without any prior coding knowledge. So let’s set up everything and start coding.

Step 1: Open the Microsoft block editor by visiting the URL: https://makecode.microbit.org/. You can also check out the Python editor. For now, we will be using the block editor.




There is a Live Simulator on the Left side and Next to that we have Package toolbar, where you can find all the block elements. Then we have a workspace on the right-hand side (Next to Toolbox). This is where you drag and drop the blocks to code a microbit. At the bottom of the simulator, you can see a download button where you can download the HEX Code and Flash it to the microbit.

Step 2: So let’s try some simple programs to get started. So let’s fire up some LEDs (I mean turning it ON) to show a Heart shaped icon to share your love using the Microbit.

Step 3: There is two block by default there are ‘on start’ and ‘forever’. The on start block runs when microbit is powered ON. Same like a logo appears when you switch ON your mobile phone. The forever event runs continuously. In this program, we don’t need the ‘on start’ event. I’m going to delete ‘on start’ event and keep the ‘forever‘ loop only.  To delete it tap the ‘on start’ then press delete on the keyboard or simply drag it back to the toolbox. Now we can start adding the other blocks.


Step 4: Just click on the Basic on toolbox then it will show the related blocks. We will use the ‘show leds’ blocks. It also shows some hint of the block and what it will do when you hover over it.




Step 5: Just drag and drop the ‘show leds’ to the workspace and fix it inside the forever block. Now choose the LEDs to make a heart shape icon. There is also a default block named as ‘show icon‘ with a heart shape. You can use that too. Here I’m showing this to draw the icons, you can also draw smileys, numbers, etc.




The simulator on the left side shows the output of the block code.

Tip: If you want to see the JavaScript code for the block codes you created, Click on the JavaScript icon on the screen. It will displays the equivalent JavaScript code.

Step 6: It will look good if the heart blinks. So let’s add ‘clear screen‘ and ‘delay‘ to it. So open basics and click more to see ‘clear screen’ just drag and drop after the show led block. Next add ‘pause 1000ms‘ similarly.


7b-How to use microbit


Step 7: Now we have the code ready. Give any filename and click save. It will download automatically to your desktop. Navigate it and then right click -> Send to -> Microbit. (Make sure you connected the microbit with Desktop via USB Cable). Once copied the folder will automatically closed and the microbit starts executing the code.


Powering up the Microbit and Start Coding - Powering up the Microbit and Start Coding - Powering up the Microbit and Start Coding - Powering up the Microbit and Start Coding


Note: Whenever you Flash (Upload) a new code the Old code will automatically be replaced by the new code. This means the old code will be erased from the microbit.


Testing the output:

That’s it. Now the microbit LEDs displays the flashing heart. You can add more delay to reduce the blinking speed.

Download it on your device and try it:

The make code editor with the code we wrote is embedded below. You can click on the ‘Download’ button to directly download the HEX code to your computer and test it on your microbit. If you want to modify the code or try with different codes, you can click the edit icon which is on the top right corner of the embedded editor. This will open the make code website to make changes for you.

Share this post

Leave a Reply

Back to Blog