zt07elecfreaks 发表于 2018-1-16 18:32:05

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.

https://www.elecfreaks.com/wp-content/uploads/2017/08/080317_1108_StartYourMi1.jpg

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.

https://www.elecfreaks.com/wp-content/uploads/2017/08/080317_1108_StartYourMi2.png
Next, log onto web: https://makecode.microbit.org/ .

https://www.elecfreaks.com/wp-content/uploads/2017/08/080317_1108_StartYourMi3.png

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.


Micro:bit: Return to homepage of micro:bit.

Projects: To build a new program or open local program or even official programs or cases.

Share: Share your program online. You can share a web link or embedded into your website.

Blocks/JavaScript: Choose Blocks or JavaScript to do program and shift between these two languages.

Help: To get help or support.

More: Program and code compiling settings.

Microsoft: Return to Microsoft Makecode homepage.

simulator: Real-time simulator. When you change your program, the virtual micro:bit can monitor your program in real time.

Blocks: Modules used to build a program.

Code compiling interface: A place for you to write code.

Download: To download program into your computer or micro:bit.

Name or Storage: Rename your program and set a storage route.

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\".
https://www.elecfreaks.com/wp-content/uploads/2017/08/1.gif
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.

https://www.elecfreaks.com/wp-content/uploads/2017/08/080317_1108_StartYourMi5.png
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.
https://www.elecfreaks.com/wp-content/uploads/2017/08/2.gif
Step 3:

Copy brick \"show icon\" and choose pattern \"heart\" in the drop-down list.

https://www.elecfreaks.com/wp-content/uploads/2017/08/3.gif
Step 4:

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

https://www.elecfreaks.com/wp-content/uploads/2017/08/4.gif
To this step, we have completed our whole programming. You can see program operation in the left simulator.
https://www.elecfreaks.com/wp-content/uploads/2017/08/5.gif
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:

https://www.elecfreaks.com/wp-content/uploads/2017/08/6.gif
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.

https://www.elecfreaks.com/wp-content/uploads/2017/08/7.gif

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

How Micro:bit works with octopus? We made a Raining Alarm demo


https://www.elecfreaks.com/9299.html
页: [1]
查看完整版本: Start Your Micro:bit Programming Trip