BBC micro:bit

While surfing the net for the latest micro controller news, I came across an article on the BBC about the new micro:bit; a small micro controller which will be given free to every school child in year 7, to inspire a new generation of makers and computer programmers. The more I started to read about this little board the more eager I was to have a chance to see what it was all about.

I was keen to look into the possibility of Matchbox getting a board to test out, and I thought it would be a good opportunity for someone who is still learning about the micro:bit to have a play with one, and see what can be achieved with limited knowledge. After gathering a small team, we had a group discussion and compiled a list of potential short projects we could choose from if we managed to get our hands on one of these little boards.

Talking through the possibilities, the list sparked even more of an interest and I decided to see if it would be possible to have a play with the development environment, which is available on the micro:bit website.

The development environment is designed to be used by children, as you would expect, and is really quick to get up and running. The first idea on the list was a simple higher/lower game; the micro:bit would generate a number between 0 and 25 and display the chosen number using the LEDs, it would then be up to the player to decide if the next number would be higher or lower. To create this I decided to use the Microsoft Block editor, which allows programs to be built up from dragging blocks of code into a main script.

So I know this is designed to be easy to use, but I could not believe how easy it was. Everything was there; loops, if statements, variable declaration, and even pulling data in from the pins and triggering a connected device to take a picture. Everything was covered and everything was easily accessible. I started to make my random number game, and 5 mins later I was done! I was able to deploy my code to the emulator which sits next to the code, and test my little game. This was fun and I can see how this could inspire a next generation of programmers, it took so little time to get an idea onto the board.

Next I decided to try and make something a little more complex. I wanted to use one of the built in sensors, so I decided to make a Simon Says game variation; the screen picks a compass bearing and the user has to turn to face that bearing. Again, because of the layout and the simplicity of the block editor I was able to get up and running in no time at all, and using the emulator I was able to quickly run a few basic tests.

A few weeks has passed since my initial micro:bit encounter, and I have been patiently waiting to receive one to test. Well, Monday morning held a nice surprise as one finally arrived on my desk! I plugged everything in and started to download my code to see how things worked on the actual device. The higher/lower game played as expected and was actually rather fun to play. Simon Says however, proved to be a little more tricky. When testing the compass using the emulator you have a handy little scroll wheel to simulate turning the device, however when it came to actually turning the device, it did not quite work as expected. Nothing we couldn’t fix, a few minor code changes later and it was all working well again.

Now that I actually had the micro:bit in my hands I wanted to make something a bit more complicated, so I started a little running man game. The player controls a pixel and has to jump over holes which would be randomly generated.

Although there are other programming languages available, I wanted to see if I would be able to do it using the block editor. This is where I hit my first road block (no pun intended), whilst editing some blocks into the main game loop, I accidentally deleted the main loop, this removed everything I had written in the game so far and for the life of me I could not find the undo button! This is slightly weird because I would have thought, with younger programmers experimenting with code, this would be a much needed feature. So my game was gone, and I was left with just one more idea I was keen to try out.

I wanted to see if I could make a room monitor using some PIR (passive infrared) sensors. After writing another short script I was able to get up and running very quickly, but there was one problem. Most of the Raspberry Pi/Arduino accessories I have need a 5v to use properly, however the micro:bit only has 3.3v. So although I was able to get some data, I was not able to get a stable reading from the sensors I had. However, I was able to get the script working with the code so that when the sensor was tripped the micro:bit would send a message to a connected device and take a picture.

I am now looking through all the sensors I have in my drawers and around my desk trying to think up new crazy ideas, as this board is so easy to get up and running and I think it is awesome for quick prototyping. I even decided to re write my running man game, which I am hoping I will be able to upload to the BBC micro:bit website soon. Keep an eye out!

This was fun and I can see how this could inspire a next generation of programmers, it took so little time to get an idea onto the board.