We’re now ready to create our 1st code. The “Hello World” greeting has been customary to all starter programming books as their first sample code. To construct our Hello World program, we need to only do three simple steps:
- Connect your BBC micro:bit to your PC/laptop via USB cable.
- Create your program by combining blocks in MakeCode editor.
- Download and save your code to the micro:bit.
As our very first program, were going to use the basic function blocks of showing the string “Hello World!” then followed by a beating heart icon in a infinity loop. To accomplish the beating heart, we need to introduce a pause of 500ms after the scrolling “Hello World!” message then pause again for 100ms, modify the heart image to depict movement, then introduce another 100ms pause and finally show a full heart image.
Notice that we used the forever block to create an infinity loop – this allows it to start from the beginning of the first line of code once it executed the last line of the code. Save and download your first program to the micro:bit. The micro:bit should be flashing its LED light when you are saving your code.
That’s it! Enjoy your first program and try to modify and experiment with the other basic block functions.