Videos / MicroPython for Micro:bit - Introduction
Learn how to setup and use MicroPython on a Micro:bit
Hi there, Clinton from Core Electronics here. Welcome to our Micro Python for Micro bit workshop, over the course of the next couple videos we're going to have a look at how to use the Micro Python programming language to program and interface with the world using the Micro bit. I've got a couple of examples of what we're going to be doing, so we're going to be looking at digital inputs, where we can turn things on and back off again, analog inputs like this, where we can change analog inputs and outputs where we can change things based on a linear scale, we're going to look at interacting with the world using sensors, so this one where I can have this virtual cup and also broadcasting through Wi-Fi, so this little circuit here that lets me send messages from one board to the other. So what we're going to need over the course of the next couple videos, is obviously firstly we're going to need a Micro bit, we need a USB cable to also connect it to our computer, we're going to need to build our actual electrical circuits is a couple of alligator clips, we have two 330 ohm resistors an LED and a 10 kilo-ohm potentiometer, we will also need to have Python 3 installed on our computer, as well as the MU editor which is a Micro Python editor or a Python editor designed to use with a couple of different boards the Micro Python being one of them another one being at a circuit playground Express. So, let's now have a look at kind of what Micro Python is and what we can do with it. So, you might be wondering what Micro Python is, so Micro Python is a modification of the Python programming language that is designed to run on Micro-controllers so boards like the Micro bit or the Arduino Uno if you've heard of that. One of the most obvious advantages of using Micro Python is that it enables an easy code to be written on Micro-controllers like previously Arduino was probably the easiest system to use and the "C" language that it uses is a lot less forgiving than the Python language these years. This does kind of come at a cost in that the code doesn't quite run as efficiently on the board as it does with the Arduino but this isn't a massive problem as a lot of the boards for the Arduino are quite dated now and Micro python boards tend to be a lot more powerful and we'll have a look at the hardware in a minute and we'll see how the Micro bit is actually a lot more powerful than the Arduino kind of when we look at the details and you can also, most Micro python boards if you want that power back you can actually program them in "C" as well. So now we're going to have a look at the hardware so first we'll look at the Micro bit and then we'll compare it to the Arduino, so we have these two buttons and this LED grid on the front that we can use as a display the edge connector makes connecting any extra electronics to it very easy and you can also use these smaller tabs and some different slot connectors to actually expand that, so you get up to 16 different outputs with this. So to compare it to the Arduino we're kind of have to consider sort of what's happening on the chip rather than on the actual board so on the Micro bit we have this tiny little chip here on the Arduino we have this great big thing here the Micro bit is actually a kind of much more powerful processor they both have the same clock speed but there's a lot of extra features on the Micro bit that makes it more powerful, so it has a bigger word size which means it can do more in each operation which will actually result in a lot quicker execution. It has more memory so that can do a lot more at the same time and a bunch of extra stuff kind of built into the board which is really cool, so you have sensors for detecting acceleration, for detecting magnetic field, so can detect like magnets or the Earth's magnetic field and use that as a compass, there's a temperature sensor on the chip that detects the CPU temperature but because the board's so small that tends to be pretty close to the room temperature and there is a way to hack it together to actually use the LED grid on the front as a light sensor. You can have a look in the tutorial, we've got a kind of listed features of the Arduino versus the Micro bit and it's worth having a look kind of how these boards differ. You're probably wondering what I can do with Micro Python in the Micro bit and really the answers are kind of limitless, it's a bit cliché to say but it's true these boards are quite powerful and the language itself is very powerful, it's also a great kind of stepping point into even more powerful boards. I hope you continue to watch these videos and the next one we're going to look at how to set off our environment and get things ready for programming the Micro Python.