Repeat multiple times

Using the commands:
– on start,
– repeat,
– show leds,
– pause (ms),

create a program where the micro:bit displays a smiley face for 1 second, then a sad face for 1 second, repeated five times. After 5 repetitions, display a sleeping face.

Instructions for creating the program


From the Basic category, select the on start block if it’s not already in the programming space.


Inside the repeat block, place the commands to display a smiley face for 1 second and a sad face for 1 second using the show icon and pause (ms) commands.


Inside the on start block, place the repeat block and enter the number 5 as its argument. All commands within the repeat block will be repeated as many times as specified by the argument, in this case, 5 times.


After the repeat block, place the show icon command that displays the sleeping face. After the 5 repetitions of the repeat block, the show leds command with the sleeping face will be executed.

JavaScript code

Although your programs are created using Blocks, you’ll need to copy the JavaScript code of your created program for solving certain escape room tasks. After you create a program in MakeCode Blocks editor, you can see its JavaScript version by going to JavaScript mode.

Copy the JavaScript code from your Repeat multiple times program and paste it into the box below:

This publication reflects the views only of the author, and the Commission cannot be held responsible for any use which may be made of the information contained therein.