What to expect
Wire Loop, Buzz Wire, Bump Maze – whatever you call it – In this activity, you will be creating a modern version of a classic game!
Connections
This activity will introduce the concepts of working with input signals – signals that are read by the micro:bit and manipulated through coding. This could be changing and storing information on the micro:bit’s memory (like keeping score or keeping track of time) or triggering an embedded output signal (such as those already on the micro:bit board like making sounds, displaying information on the LED matrix) or activating an external output signal connected to a motor or more (you’ll do this in later activities!).
Want to see something cool?
How about a robot playing a wire loop game
Instructions
Building the Game Board
The hardware for the game is made up of 4 main components:
Materials
Micro:bit w/ USB cable and battery pack
4 Alligator clip wires
Game board base
1 Washer
Pre-cut Wire
2 screws
Introduction
There are three basic steps. First, you’ll assemble the hardware (game board). Next, you’ll program the micro:bit. Finally, you’ll connect the micro:bit to your hardware, test and play your game, and then modify your “software” to create a unique gameplay experience!
Figure 1. Game board with micro:bit connections
Add a screw at the start (a) and finish (b) as shown. Don’t screw it all the way down. Leave a little bit sticking up so that you can clip an alligator wire to it as shown.
Shape your wire (d) by carefully bending it by hand. Tip: Start with a simple design at first, then revise your design if you want to make it more challenging.
Be sure to slide the washer (c) onto the wire before the next step. This way, the washer won’t be able to leave the play area.
Place each end of the wire in the smaller holes. Carefully push the wire down and make sure that your “loop” is supported.
Connect alligator clips to the game board elements as shown. Color doesn’t matter, but you’ll want to make sure that you connect the other ends to the correct location on the micro:bit in a later step. You’ll have 4 wired connections:
(a) Start screw
(b) Finish screw
(c) Washer
(d) the wire loop
2. Programming
Figure 2: Micro:bit start code for the wire loop game
Load the sample code provided. (Get the code here: Code link.) In short, the Micro:bit detects when conductive surfaces have been touched and provides input signals that can be programmed to do something (in this case keep track of time). Although they aren’t really buttons, the pins have two possible states, similar to pushbuttons: on or off. Another way to think of this is 0 or 1. That’s why the provided code uses “on pressed” to describe the action.
Integrating the Hardware and Software:
For this activity, you will be only be using the “ring” pins of the micro:bit for the inputs.
Connect as follows:
(a) P0 to the game “start” signal
(c) P1 to the wire loop
(b) P2 for the game “finish” signal
(d) GND to the washer (fun fact: this completes the “loop” of the circuit)
3. Test your game. How did you do? If the maze is too easy or too hard, consider the ways that you could modify your game by either changing the shape of the wire (hardware change) or changing the program (software change).
4. Programming ideas to try…
Add “lives” to your game… Perhaps you get 3 tries to complete the maze!
Make it so that it adds “penalty time” but doesn’t end the game if the washer touches the wire…
Add additional sounds or display on the LEDs…
Make a “reverse edition” where the washer MUST touch the wire at all times!
Get creative! 😀 Add something that gives the game a new twist on an old classic!
Problems with your game?
Some common errors could be
Microbit not powered on (check the battery or USB connection)
The alligator clips aren't clipped on well.
The alligator clips aren’t connected to the proper places.
Think about it
In this activity, you built and programmed your own wire loop game. This is a good example of using hardware input signals to provide information to your software program.
Did you modify your game software? If so, what did you do and why?
How could you improve your game’s hardware?
Feedback link
Next Time
In the next activity, you’ll learn how to control a DC motor using a special board that adds extra capability to the micro:bit such as controlling external input and output devices.