empowering creative people

Videos / MicroPython for Micro:bit - Getting Ready (Firmware Setup)

To start with we need to set up your micro:bit so that it can be programmed with MicroPython.

Search Videos

Related Content



Clinton here, from Core Electronics, welcome to part two of our workshop on using Micro Python on the Micro Bit, for this tutorial well we're going to have a look at is getting everything set up and ready to start programming and the first step in doing that is installing the firmware.

So, the first thing we're going to do is flash the firmware onto the Microfibre, to do this we need to start up the Micro Python in maintenance mode so if you turn your Micro Python over on the back, there is a switch here that says that's for resetting it. If we hold this switch down like so and then insert the Micro USB cable while holding it down, you'll notice that it'll pop up instead of being Micro Bit as it normally is it says maintenance, this means that we've started the Micro Python in the mode that lets us make changes software running on there. So now we need to download the actual Micro Bit firmware, so you can find the link for that in the tutorial.

So I've already got the page up so you just scroll down to this download latest Micro Bit firmware, I click download I go there I can show in folder and here I have my downloaded Micro Python and firmware to copy this on and to run this update, all I need to do is copy drag that straight into the E Drive this will copy over and then I wait, once the firmware’s copy on the Micro Bit, it knows what it is, it runs that update and then returns to us as Micro Bit. So now we have the latest version, we can check this by just opening this details txt so down here interface version 250, this matches the 0250, so we know that our updates worked we can now close all this down because we're now ready to start actually programming on the board and looking at how we can do that.

Ok, so now we're going to actually look at how to edit code on the Micro bit using Micro Python, you can do this anyway so you can write any files you want any Python files and copy them over as long as they're called main.py, copy them into that thumb drive and they'll run so you can use any editor you would like, anything from notepad through to Visual Studio, what we're going to be using today is an editor called MU, which has been designed to work with the Micro bit to give us a few extra features that will be really helpful for debugging and looking at other things.

So, if you haven't installed it already there are links in the tutorial that will let you do that, but I've already got it installed here. So, I just go to the Start menu I type MU and I open it up, wait a moment. So I've already loaded this up before and so it's remembered my last state and come to Micro bit, if you haven't used it before it will present you with this screen so you can use this editor for doing circuit Python with any of the Adafruit products or the Micro bit the PI game zero or just any normal Python 3 programs. So, I've got a piece of code already in here, this piece of code will run on any Micro Python board, so it doesn't matter if it's one of these or an ASP 32 or anything else, it will run. We don't need to worry too much we'll look at into it later so here we have this bar across the top, this basically gives us access to the different functions we need, we can create new files, we can load files, we can save our work and we can also flash programs to our Micro Bit. So, clicking the flash doesn't matter what name I have in my file that will then write that file to the Micro bit and execute it. It'll change the name on the board so that it will be main.py so that it will run, which is kind of handy.

So, the next option along after flash we have the files option, and this lets us explore the file system on the Micro Bit. We can click on this and it brings this up, it tells me what files I'm currently working with and what files I currently have on my Micro Bit, you'll probably notice even if you're not using a file named main.py on the Micro bit, it will be called main.py. You'll also notice here that these other options have become greyed out, this is because the files are now taken control of the Micro bit and we can't talk to it in any other way at the same time. So, to use the next option we need to click this again and that will re-enable those other options.

So, the next option along is repl and this stands for Read Evaluate Print Loop and this is one of the most useful features you will find out of these. When I click this my other options grey out, but I'm also presented with this terminal window down the bottom. In here I can do maths, I can run Python code and also this will output any code that's running on the board, so if I were to reset the board by pressing control D, this soft reset the board and we can see here "Hello I am Micro Bit", I can do 16 million things per second and this is the output of my code so this is incredibly useful when you're trying to debug your Micro Python code, so yeah this tool you will be using a lot as you're kind of advanced with Micro Python.

So, I need to then click this again and then I can start editing and doing other things. That's everything we need to know for getting started with programming the Micro Bit with a new editor. In the next video, we're going to start doing some code and wiring up some circuits and we're going to be using digital inputs and "if" statements, so I look forward to seeing you in the next video and thanks again for watching.