What are we going to do?

Computer programs are instructions telling the computer how to process input and deliver output. An important part of programming is telling the computer WHEN to perform a certain task. For this, we use something called ‘conditionals’. Conditionals get their name because a certain Condition or Rule has to be met.

For example, have you ever had your parents say..?

  • “If you clean your room, you can go out with your friends.”
  • “If your homework is done, you can play video games.”
  • “If you do your chores all week, you get your allowance, else you are grounded.”

These are all conditionals! Conditionals follow the format of IF this, THEN that.

Objectives of this activity

  • Understand what conditional statements are, and why and when to use them in a program.
  • Learn how to use the Logic blocks ‘If…then’ and ‘If…then…else’.
  • Practice using the Logic blocks so different conditions yield specified outcomes.
  • Demonstrate understanding and apply skill by collaborating with classmates to create a game that uses a micro:bit and a program that correctly and effectively uses conditionals.

At the end, we will play Rock, Paper, Scissors against our mi:pet, let's try to beat him!!


micro:bit board

The micro:bit was designed to be classroom-friendly from day one. More approachable than just coding, it's a great way to achieve fun, practical results with motivated students. Buy from here starter kit (recommended) or board only.

micro USB cable

If your micro:bit board didn't came with a USB cable, any microUSB cable should do the trick


The code editor is web based, so any computer with a web browser (and Internet connectivity) will do

mi:power board

The MI:power board for the BBC micro:bit is a stylish way to power your BBC micro:bit from a 3V coin cell. A piezo buzzer is built in and a battery is included.


1 Open editor

Once you've opened the editor, pick a name for your project. Remember that it should be something that easily identifies it. To create a program, you just have to select some blocks from the left side of your page and drag and drop them to your workspace.

Click to zoom

2 Code with blocks

From the list of possible blocks, choose the ones needed to code something like the picture below. You can test your program with the simulator on the left of the screen. Once you're happy with the result, click on "Download".

Click to zoom

3 Upload to the board

When the program is ready and you click "Download", connect your micro:bit board to your computer using the micro USB cable and drag and drop the HEX file on your micro:bit drive.

Click to zoom

4 Assemble mi:power
Follow this video and play against your micro:bit

Now it's your turn!

It was about time to let you try it for yourself! I now propose some challenges that I encourage you to do. I think they are fun and I trust you can pass them!

Remember that each time you change the program by adding or removing some blocks, you can see how it looks at the left side of the editor. When you're happy with the result, you'll have to download it again and send it to micro:bit board following same steps as before.

Here you have some challenges:

  • Mod the game to use different images or to add more options like ‘Rock Paper Scissors Lizard Spock’
  • Extra challenge. Are you able to keep score of both your wins (mi:pet and yours)? Tip: remember last activity 

If you managed to finish this activities, you can search for more challenges on micro:bit's website

What else?

Now that you have your micro:bit code ready, it's time to use it! Play a couple of Rock, Paper, Scissors rounds and see who is the Rock king!!

Continue your maker journey with the next activity: Let's do some magic!

or return to maker workshop main page