Let’s do some magic


What are we going to do?

This is a simple magic trick you can perform to amaze your family and friends! When you move the button caps covers on your mi:pet’s A and B button, you appear to make the buttons really switch over! Awesome!

Materials

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.

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.

micro USB cable

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

3D printed parts

You can download the stl files for 3D printing it from MyMinifactory

Download

Computer

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

Instructions

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", an HEX file will be downloaded to your computer (normally to your download folder). If download succeeded, a message will appear on your screen. Click "done".

Now, connect your micro:bit board to your computer using the micro USB cable. Your computer should now detect your micro:bit just as if it was an external drive. Search the HEX file you just downloaded and drag and drop them on your micro:bit drive. On windows you can right button on the HEX file and click send to MICROBIT.

Click to zoom

4 Final result

After a few seconds, your program should start on your micro:bit board.

Congratulations, you're on the right path to be a maker!, now continue with the following challenges! 🙂

Now it's your turn!

Now, to be able to perform your magic, you need to assemble the mi:pet button first. Follow this video tutorial:

Once it's assembled, you just need to practice the trick a few times before performing for your friends. Try asking your friends to click the buttons after you have switched the buttons and the trick won’t work for them!

IMPORTANT: if your trick does not work, try changing the magnetic force comparison (60 in my example) by increasing or decreasing 10. For example try 50, 70, 40, 80...

Remember, that as we are using micro:bit’s compass, it will need to be calibrated each time we flash the program or run it for the first time, and this must to be done when the magnet is away.

 

What else?

Now that you have some practice, you can show it to your family and friends. But first, do you think you're able to add some music? The mi:power module that you have assembled has a built-in buzzer, so you can play some tones and melodies, awesome!

You can download the solution to this challenge in this link but don't use unless it's necessary!

Finished?

If you finish with you magic trick, you can download and try this Flappy bird style game here: download crashy bird

 


Continue your maker journey with the next activity: LEDs and coordinates

or return to maker workshop main page