As a fun summer project, members of the Fujitsu Fundamentals of Programming Radar stream were recently sent a BBC micro:bit. As one of the mentors on the stream, I was lucky enough to also get one to play with.
This is my first time using the micro:bit and I could not wait to receive my kit. It all arrived in a nice box, with some add-on items to get you creating as quickly as possible.
After getting over the fact that this little piece of tech is probably more powerful that my old BBC Micro model B that is sitting under my bed upstairs (with the tape drive and a whole bunch of games for it), I decided to stop reminiscing and look into the challenges we were setting.
There are three challenges in total, my initial plan was to see how straightforward they were to do. I do have to admit that the Super Stretch task likely requires more imagination than I have at present, due to the fact that I do not have any kids to give me wild and wonderful suggestions on what to do with the micro:bit, and Alexa runs my home/life quite effectively.
Base Task: Make the micro:bit scroll your name in the LEDs. Upload your code, and send the mentors a video of it working.
Stretch Task: Make your micro:bit do something else interesting without adding any further hardware. Anything you like.
Super Stretch Task: Using no more than £20 of additional hardware or components (excluding your laptop/desktop), an IoT project. Again, anything you like.
As programming languages go, I like Python, so went with that option.
The mobile app:
I love my iPad, it is surgically attached and goes everywhere with me, so trying out this app was a no brainer. The app is very easy to use, you can choose which language you wish to code in, so ‘Python only’ was my choice. The interface gives you options of various tutorials, or you choose a ‘New Project’ and just go for it.
The app works just like a modern IDE (Integrated development environment), in that it gives you options for the relevant statements and syntax as you type with a menu that gives you example code for music, arrays etc. Interestingly, it was not that reminiscent of the Python I am familiar with, but it is straightforward and if in doubt use the examples under BASIC, MUSIC, LOGIC etc to get you going. If you need more press the question mark and it takes you to the reference library.
It is extremely easy to complete the base task that has been set using the app.
I like the fact that the app gives you a preview of how your code will run on the micro:bit, and if you try and use ‘normal’ Python it gives you the debugging information, including telling you when you have not indented in the right place.
Downside to the app, it only allows you to copy a single word at a time, or everything, could not find a way to copy 2 lines of code to move them somewhere else. I also found it annoying that my onscreen keyboard did not have a tab key!
To upload the program to your micro:bit, you pair you tablet to it using Bluetooth. This is simple and I do like the way your device has been assigned a name, mine was vaviv.
MakeCode Web App:
The MakeCode web based editor is the same interface as the app, you just get the option to download your program (Hex file) to transfer it to the micro:bit. All of the menu options work in the same fashion, examples are there as well as the links to the documentation if you need additional information.
Python web editor:
There is some information about Python for the micro:bit on their website, along with links to the editor and the documentation. This editor uses Micro Python, which is a bit more like what I am used to. There are some differences which are specific to the micro:bit module for Python that you need to import, but there are plenty of examples and tutorials available.
Most important thing, this editor wants you to use Chrome, it does not like Microsoft browsers at all, so do not bother trying it in Edge or Internet Explorer.
Once I had programs running and uploading successfully in a short space of time, me being me, I tried to see if the program I wrote in the Python web editor would work in the MakeCode app/web app. It does not work, there were 13 problems with 7 lines of code!
Turning it around the other way and using the program from MakeCode in the Python web editor and there is no validation of the code prior to it being uploaded. It all uploads successfully and you see letters scrolling across the LED screen and you think result, it works, then you realise that the letters spell SYNTAX ERROR!
To go a bit further, I tried a few minor things with the random module in Python, some of the things I tried worked first time, other things did not. This time round, I did not get a syntax error, once the code was uploaded the message UNDEFINED scrolled across the screen – there was a bit more to it, and I was tempted to grab a video of it and see if either anyone could tell it was not my name, and I may still do that, I just need to work out how to get a 40mb video from my iPhone to the corporate network. It is a nice to see that the micro:bit is capable of displaying an error using the LEDs, but not exactly the easiest way to debug a couple of lines of code.
From the various apps/editors you can use with the micro:bit, the app for phones/tablets is the best when you just want to get started. All of the tutorials and reference documentation is available to you if you need it, and it gets you uploading your code in the shortest amount of time with the least amount of fuss and cables.
Whilst I have not got around to playing with any of the added extras that came with it yet, there is still time, and I am very interested to see what other people come up with.
Finally, I deliberately have not shown any code examples above. It is extremely easy to complete the first two challenges without picking up a single crocodile cable, bread board or LED, so to everyone on the Radar Fundamentals of Programming stream, open you kit and get creating.