Micro:bit Block Programming:
Customizing Displays

Review the default blocks of code that are in every program they create for the micro:bit, that is, the on start and forever blocks. Also remind the students that these blocks can be deleted if they are not used.

Review the show string block and the show icon block. Demonstrate the display of the heart (used in "Hello World" lesson) and look at some of the other images that are built in to the MakeCode programming language. Specifically look at chess board, house, and giraffe as students will be recreating these images later in the lesson.

Customizing Displays on the LED array

This lesson focuses on the show leds block and the plot x __ y __ brightness block

The show leds block is a quick way to create custom images. However, it does not let you control the brightness of each led. This block is found under the Basic block type. The image at right shows one way of lighting only the top left LED.

The plot x __ y __ brightness block is used to change the light levels of individual pixels. When using plot x __ y __ brightness you must specify three arguments: the x-coordinate, the y-coordinate, and the brightness level. The x and y coordinates range from 0 to 4, starting with 0,0 in the top left corner of the micro:bit display. The brightness levels range from 0 to 255. The standard for each LED is 0 which means that it is off. This block is found under the Led block type and then clicking ... more.

To turn the top left LED on with full brightness using the plot x __ y __ brightness block would look like this:

After students become familiar with the command and the use of coordinates, give them the task of recreating the following images with their own code: chess board, house, and giraffe. The code for each of the images is included on the following pages.

Challenge students to create their own images using varying light levels.

Chessboard

Using show leds block:

Using plot x_y_brightness block:

House

Using show leds block:

Using plot x_y_brightness block:

Giraffe

Using show leds block:

Using plot x_y_brightness block: