Have you ever wanted to program your microcontrollers with Python instead of Arduino? MicroPython and CircuitPython bring the ease of Python to microcontrollers by adding hardware support! In MicroPython, Python is largely unchanged other than the added functionality to interface with hardware.
Hi, Steven here from Core Electronics, today I want to talk to you about Circuit Python versus Micro Python and we'll talk about the key differences between the two.
They're both based on the popular Python programming language, with added support for hardware and both Circuit Python and Micro Python are largely the same, the key difference is that Circuit Python is made by Adafruit to support the Adafruit brand boards, the ones that are made specifically for educators and beginners and Micro Python is a broader category of boards. So, Circuit Python is based on micro Python, so whenever an update comes out for Micro Python it's then rolled out for Circuit Python as well and the differences in Circuit Python is just to like I said Adafruit support for Adafruit's Boards and they make a few changes just to make it a little easier for someone learning to understand what's happening on their board and in their code and make it easier to troubleshoot.
So, let's look at some of the things that are different;
One of the first things that's different about Circuit Python is how your code behaves on a microcontroller. So, one of the difference is that the order that the files are run when you put files on to your microcontroller and whether they share any States. In Micro Python, you can have different files running at the same time and sharing the same state. Where in Circuit Python there's no sharing of States, so when one thing's running it's the only thing running and that can make it a lot easier for someone new to understand what's happening if something goes wrong.
The boot files so boot.py or settings.py, only runs once in Circuit Python before the USB is even initialized and then it's not run again.
Code.py, so your main body of code in Circuit Python is run after each reload until it finishes and if you want to enter the repl, you can't be running code.py at the same time, so it'll stop your main body of code and enter the repl. So, there's no shared state between them, which there is a little bit of loss of functionality there for a higher end user but for most users, it's good that there's no overlap, so it can be a little clear what's happening.
One of the other nice things that Circuit Python has changed, they've created unified hardware at api's. So, when you want to utilize Hardware on your board, you need to include libraries to make that happen and the api's for Circuit Python is much condensed, so if you want to use audio it's audioIO, if you want to use analog, it's analogIO and it really makes it simple to utilize actual hardware parts without needing to pull in a bunch of libraries or use a bunch of different commands.
There are also some changes with modules in Circuit Pythons, so there's a lot of slightly different time modules. So, if you're doing something that involves time and you're moving from Micro Python to Circuit Python then just be aware to look at that and determine if there are any changes that affect your code, if you're new to either then it's nothing different enough that you need to worry about if you're going to choose between one or the other.
So those wraps up the differences that I think that the average user would really run into well while using Circuit Python or Micro Python. If you want to learn how to use Circuit Python you want to learn how to program with it, we've got a lot of tutorials in our tutorials section about how to program with Circuit Python for the Adafruit Circuit playground Express. So, go check it out.
SKU: ADA3333 https://core-electronics.com.au/circuit-playground-express-developer-edition.html
Makers love reviews as much as you do, please follow this link to review the products you have purchased.