Today’s society is obsessed with technology. We are surrounded by devices that make our lives much easier, yet people are still bored when they have nothing to do. One way in which children can learn about coding is through programming devices like the Microbit. Alongside this, playing games on Microbits provides an excellent medium for teaching coding in a fun setting. Microbits are a great platform to help children learn about coding within a physical context. Coding for kids with Microbit is not just about the programs themselves but also the physical materials being used and how you interact with them – in other words, physical tinkering with Microbit Games.
Physical tinkering is a term coined by Microbit to describe the all-around fun of playing games. This includes physical interaction with Microbits, tinkering with pieces of code & physical stuff we see around ourselves, and experimenting with different inputs for Microbits. Physical Tinkering is a process of an experiment that is more playful, experimental, and creative rather than following firm rules. With tinkering what you get at the end of it can be very surprising! Tinkering is all about applying simple ideas to make something new and original – sometimes they work but sometimes they don’t, but it doesn’t matter because you are experimenting! For example, when tinkering, there are no wrong answers so kids might build an interactive game with Microbit scratch coding. In this blog, we will learn how to create a Microbit football game. This game (Microbit football game) will let the students learn computational skills as well as give them a chance to tinker with different materials to come up with their final prototype. Aanya is a student at Skoolofcode who built the Microbit football game as her project while learning Introduction to Makecode and Microbit in Skoolofcode.
Materials required for the Microbit football game
- Cardboard (lightweight) or a Box
- Scissors
- Tape or Glue gun
- Microbit with batteries
How does it work?
When you are playing football, one of the most important parts is to keep track of the score. If someone scores a goal, how will he/she know? The score can be tracked through the scoreboard. The Microbit is placed on the basket area of the goalpost so that whenever the ball hits the goal the microbit registers the motion and thus increments the score. Lightweight cardboard can be used to create the goalpost or the basket area of the basketball post. For the football game, we will be using the accelerometer sensor of the microbit. The accelerometer sensor helps the microbit to detect movement.
What is an accelerometer?
An accelerometer is a sensor that allows the microbit to sense motion. It can sense acceleration in x, y, or z-direction. Also, it can measure the total acceleration strength (combined acceleration in all directions). Microbit can measure different gestures on shake, tilt, and free-fall through the accelerometer sensor.
Let’s get started with the Code
Makecode can be used to code the Microbit. Makecode is a graphical programming language which can be accessed through online editor . The Score of the game counter can be stored in a variable that can be updated when the motion is there (sensed by Microbit).
We will create a variable called Score. Also, we will initialize the variable when the game starts or Microbit starts. So, will use the “on start” block as shown in the picture below.
It would be a good idea to use some sound when the Score is updated. We will use the play tone block from the Music section.
It would be a good idea to use some sound when the Score is updated. We will use the play tone block from the Music section.
After this, we can download the code on our Microbit. More details on how to download your code can be accessed in this blog. Attach the battery pack with Microbit.
Time to tinker with materials
Use the cardboard box as the goalpost. Attach the microbit with batteries on the box with tape (as shown in the picture). You can use a ping pong ball or you can make a ball using Kitchen foil. It’s time to play. So, let’s start playing the Microbit football game by starting a timer (let’s say a 30-sec timer). Now throw the ball near the goalpost. In case the ball goes near the basket the score will update and we can see the score on Microbit and hear some sound also.
Are you seeking introductory programming courses or a place to engage your child in coding classes? In order to build future-ready creators, we at SkoolOfCode believe in a holistic STEM-based coding curriculum that is personalized to fit the needs of each student. So, why wait and Book a FREE trial class today.