About the event
Ready for a new coding challenge?
The Micro:Bit is a neat little piece of technology. It is a small portable, user programmable computer which you can use to create fun games, animations and more.
But you don’t need a physical Micro:Bit to get hands on with coding for this mini-computer.
The special Micro:Bit Microsoft MakeCode site allows you to create code and test it on a Micro:Bit simulator. You can make animations or games and see them working on your screen. You can even make a game you can play against the simulator.
This will take you to a page to make a new project.
The coding works with drag and drop blocks, similar to ones you might have used in scratch. The coding is what we use to make a programme. This is a set of instructions to the computer. You will build your own program and will test it to see if it is correct. This is a great way to make programs because we can create simple programs and then see them working.
To write a program, you can start by dragging and dropping blocks from the centre column into the blank space on the right. Each block does something different, and they snap together so you can be sure they will work in sequence. If you are not sure if blocks go together then look at the shape and if you need more options look for the settings button.
To delete a block simply drag it back over the centre column.
Once you have written your code you can use the Micro:Bit simulator on the left side of the screen to test how it works. Press button A or B or both or you can ‘shake’ the Micro:Bit.
Edinburgh Science Festival Challenges
1: Create a program to show a LED picture of your choice when you press the A button.
(Hint: use the “on button press” block, and the “show led” block)
2: Create an animation by showing two diﬀerent pictures, with a pause in between each picture.
(Hint: use the “forever” block and the “pause” block)
4: Create a counter and set button A to count up, and button B to count down. Make sure you show the counter on the LEDS when the buttons are pressed.
(Hint: use “set item to” block and “change item to” block)
5: Create a countdown timer that starts at 5 and counts down the seconds until it reaches 0.
Extra: Add an animation for when the countdown reaches zero.
Extra: Add a feature where one of the buttons increases the starting number for the countdown.
6: Program 3 different pictures to show for shake, button A and button B. Use the inputs to tell a story with the pictures.
7: Make a name badge which always shows your name.
(Hint: use the “forever” block)
8: Make a decision making dice so when you shake the microbit it displays ‘yes’ or ‘no’ at random.
(Hint: use ‘pick random 0 to 1’)
9: Program a game of rock, paper, scissors.
Play against the Micro:bit simulator.
(Hint: Use the “if, then, else” block and the gear symbol to add more “if, then, else” options. Use set item and the math block pick random)
10: Create a reaction game. Set the screen to show an instruction at random (shake, button A, button B) and only allow the game to continue if the correct response completed. Add a game over screen.
Use the press A+B at the same time to test your code.
Extra: add more reactions by selecting the arrow next to shake
Developed with support from