Start Your Micro:bit Programming Trip

Start Your Micro:bit Programming Trip

Micro:bit is BBC launched micro-computer product for children at grade 7. Since it it a product designed for children, then every step of operation must be easy enough for children to understand. BBC do not disappoint us for the biggest feature of micro:bit is very easy to use. If you have never touched programming, that doesn't matter. Microsoft has developed a programming environment based on web for micro:bit. It is named Makecode, which use Blockly based on Google to compile code just like playing bricks. You just have to drag blocks, then you can make a program. You can done it by yourself alone, or with the help of your parents. To program with your parents, it will be a good time to enjoy family love. In the following passages, we are going to show you a detailed course of Micro:bit and start your programming trip together. Today, let's learn how to use Blocks interface to compile your first program. First of all, connect micro:bit to your computer. Use a USB cable to connect micro:bit to your computer, then you will find the yellow light on micro:bit lighted.

And on your computer, micro:bit will be loaded into your computer as a outer storage device. If you see an outer storage device named MICROBIT in your computer, then it shows you have complete the connection successfully.

Next, log onto web: https://makecode.microbit.org/ .

We will see the interface like the above picture. And then, let's get to know each segment function according to the serial number in the picture.

  1. Micro:bit: Return to homepage of micro:bit.
  2. Projects: To build a new program or open local program or even official programs or cases.
  3. Share: Share your program online. You can share a web link or embedded into your website.
  4. Blocks/JavaScript: Choose Blocks or JavaScript to do program and shift between these two languages.
  5. Help: To get help or support.
  6. More: Program and code compiling settings.
  7. Microsoft: Return to Microsoft Makecode homepage.
  8. simulator: Real-time simulator. When you change your program, the virtual micro:bit can monitor your program in real time.
  9. Blocks: Modules used to build a program.
  10. Code compiling interface: A place for you to write code.
  11. Download: To download program into your computer or micro:bit.
  12. Name or Storage: Rename your program and set a storage route.
  13. Undo and Zoom: Undo and redo your operation; zoom in or out your program bricks.

Next, let's take an example to learn how to use Makecode. We are going to write a heart-bit program for micro:bit.

Step 1: Build a new program and name it "heart".

We can see 2 bricks already existed in the compiling interface. If you have played Arduino, you will find this is very similar to Arduino initial code. "On Start" is for initial brick and only carry out once. "Forever" is for circulation brick which makes program circulate.

Step 2: Choose "show icon" in "Basic" brick, drag it into the right compiling interface with your mouse and embed it into brick "forever". When you release your mouse, you will hear a crack voice, which shows your brick is well- placed. 2 Step 3: Copy brick "show icon" and choose pattern "heart" in the drop-down list. 3

Step 4: In order to prevent too fast rotation of pattern displayed, we have to add a little delay.

4

To this step, we have completed our whole programming. You can see program operation in the left simulator.

5

Step 5: After checking and no default founded, download your program into micro:bit. There are 2 methods for download: one is to preserve ".Hex" of the program in your computer and then copy and paste into outer storage device "MICROBIT" just like a USB flash disk , the other is download program directly into MICROBIT. Here, we use the latter method: 6 Once we completed download, your program will run automatically. You can see your micro:bit and check whether the animation on display is same like your program. Now, you have finished your first micro:bit program. Isn't it make you feel a sense of achievement? You can use "share" to send the program link to your friends and tell them your experience to share your happiness of programming. 7 Or you can embed your program code into website or blogs, just like the following:

In the share web page, not only you can see whole code, but also check simulator and download program just like Makecode. Relative Readings: How can we know someone is closing beforehand? How to make a counter with micro:bit? Elecfreaks Micro:bit Adapter Light Micro:bit with Mbed We made a Raining Alarm demo