blocks, events and messages
In this section, we are learning different ways for the micro:bit to receive commands, or as they are called in coding, events. Events enable the interaction between us and the device (micro:bit). Some equivalent events in our daily life are:
Pressing a key on your keyboard
Starting a car by turning a key or pressing a button
Saying a command to enable your phone's digital assistant
The events we are exploring in the micro:bit are on start, forever, on shake and on button A pressed.
Did you notice that the blocks in the Block groups area are colour-coded? This makes it easy to look for blocks you see in the example activities.
We can trigger events with many different blocks in MakeCode as we saw in this section, but so far we only displayed text. In the next section, B - Animations, we are working with images.
In this section, we are taking our code to a new level. As humans, we see, smell, touch, taste and hear the world around us, and we are going to use some of those senses to help the micro:bit do something similar, by utilizing different sensors built into it.
The first sensor we'll work with is the ability that the micro:bit has to detect temperature and along with it, we'll learn the concept of if statements in coding.
If statements provide computers with the ability to choose between different options or paths. It opens many different possibilities and makes our programs more interesting and diverse.
We don't need a physical micro:bit to test the temperature option. The emulator provides a way for us to see and test different temperature levels.
These projects will help you when working on the main Activities as they all use micro:bits and MakeCode as the brains controlling the visualizations and servo motors. It is time to continue, learning about the other tools. See you in the next section 03 - Servo Motor.
In this section, we are doing math with our micro:bit. Math is a key element in any human endeavour and after this lesson, you will be coding your own calculations in no time.
Let's start our Math and micro:bit exploration by counting. First, we will create a counter from 1 to 5 using a basic approach, and then we'll find a better way to do it, with more control.
Before attempting each of the following parts, try to create code that counts, while considering the following points:
What to display on the micro:bit?
When to change the count? What action on the micro:bit will trigger the count?
By how much are we counting? Are we counting up (adding, multiplying) or down (subtracting, dividing)
What blocks do we need to display our count?
See more information about these powerful concepts in the Teacher's Corner - Counting, below
Great work in getting the counter working! time for a mini-challenge.
We have made lots of progress and in the next section If Hot!, we will explore some really exciting concepts in coding and the micro:bit!
Images are very useful to express complex concepts in a simple and fast way. They are also fun and creative! In this section we are going to experiment with images and animation, bringing our creations to life.
The micro:bit only has 25 LEDs to create text and images, but you'll be surprised at how much can be said with so few lights.
It's alive! Well, at least the heart beats once. Now it is time for a mini-challenge!
Every time you see the red question mark❓, it indicates a mini-challenge for you to try. After completing the challenge or giving it fair try, proceed to open the container and see how we solved it.
Imagine how many other different animations we can create. Maybe you can tell a story using a micro:bit animation!
In the next section, we are getting serious about math. See you in Counting!
MakeCode is a platform that helps us create programs that the micro:bit can understand in any of three different computer languages, Blocks (KCJ's choice), JavaScript and Python.
Not only MakeCode is the ideal environment for us to teach code and interact with the micro:bit, but it also has a built-in micro:bit emulator, providing an easy and fast place to test our code.
In this section, we'll go over the main MakeCode platform concepts that your students need to be familiar with to comfortably start their coding journey with us. Start by visiting on your favourite browser the following site .
Once on the site, click on the big purple button that says New Project to navigate to the main application. You will be prompted to give your project a name and then click on the Create button.
The process may take some time depending on the computer speed and internet connection, but once all is loaded we'll be in the main area of MakeCode.
MakeCode can be divided into three different areas. the Workspace, the Blocks and the Emulator. Let's take a look at each of them:
This is the empty area on the right side of the screen. This empty space is waiting for you to add blocks to provide instructions that the micro:bit will execute. By default, it has the forever and on start blocks.
The Blocks area is where all your available instructions are located, conveniently grouped into categories and colour coded.
This is our testing ground, the virtual micro:bit. This emulator has most of the functionality of the physical version and a few extra tricks that you'll learn at some point.
There are many more options to explore on the screen, but these three are the essentials that will enable the students to start using MakeCode
With a micro:bit and MakeCode, we could create interesting applications to visualize data, but we are introducing more tools that will add variety to our creations.
LED stands for light emitting diode. LED lighting products produce light up to 90% more efficiently than incandescent light bulbs. How do they work? An electrical current passes through a microchip, which illuminates the tiny light sources we call LEDs and the result is visible light. To prevent performance issues, the heat LEDs produce is absorbed into a heat sink.
Some more information from .
In computer science, a loop is a programming structure that repeats a sequence of instructions until a specific condition is met.
More information about Loops from
If you like to learn more about MakeCode and the micro:bit, continue to A - Events. If you are already familiar with micro:bits, continue to the section where we explore our first tool, the .