So…. You want to do a lot more with your Micro:bit?
So recently, I’ve found myself playing around with my Micro:bit a lot more. I’ve thought to myself, wouldn’t it be great if I could combine two different programming languages.
I thought, wouldn’t it be great if I could make a game (within a game). Well did you know that you can! You can use your Micro:bit as a game controller and you can get your students to program the controls in the micro bit user interface.
The issue, that I found while hunting high and low on the internet is that there weren’t many ‘instruction guides’ on how to do this. They were all pretty vague and made it quite difficult for teachers to figure out.
Step 1: – Firmware! – What they don’t tell you before you start trying to play around with ports, is that your Micro:bit needs to have the most recent version of the firmware.
If you follow the link above, there is a really easy to follow guide on getting you to upgrade your firmware for your Micro:bit. This will now allow you to use serial transmission on your Micro:bit.
To double check that you’ll be able to do this, please go to Device Manager on your computer.
You should see the serial port!
Step 2: – Setting up your game controlled. To keep things simple I’m going to walk you through how to set this up using the Micro:bit website.
Using the editor on microbit : – https://makecode.microbit.org you can create a new project.
Create your controller using the following blocks.
Nice and simple. A, B and AB. We can do a lot more with this later on but for now, we’re going to change the output on the screen.
Now that you have created this, code… you’re going to need to download it to your Micro:bit.
Click on download and save it directly onto your Micro:bit.
You have now got a basic controlled working. It will send signals to the coms port on your computer. If you looked in device manager, you’ll notice that mine was in COMS3. Remember this for later.
Step 3: – Plugins!
You can’t quite get it to just ‘work’ with Small Basic. Unfortunately, you have to do a little bit of background work. It’s not too complicated.
Please visit this website first: http://litdev.co.uk/
Download the DLL files. I promise you that these are safe and will not harm your computer! Pinky promise!
Go to your windows drive.
C:\Program Files\Microsoft\Small Basic\Lib
There are lots of files in the library that you’ve downloaded but you’ll only need the two highlighted in the image below. Copy these into your lib folder.
Step 4: – Small Basic
Now that you’ve downloaded the libraries into your Small Basic folder, you’re ready to start coding using COMS3 on your Micro:bit.
This code starts by setting up the board so that it can communicate with the device. It works much like an Arduino.
I’ve created a basic loop that is always looking for the input of the board. It looks for the A and B which I showed you earlier.
I have included a delay so that it’s more effective.
The sub routine gets the data in from the board and says that it’s looking for the text to be input from previously.
Have a play around with this but I think that you could create some really good projects now that you can control the serial inputs and outputs!