empowering creative people

Videos / Circuit Playground Express Workshop - Chapter 6 - Programming with CircuitPython

CircuitPython is based on the Python programming language and is a derivative of MicroPython created by Adafruit. What does that mean to the user? CircuitPython is like Python with added support for hardware, and its designed for the education platforms that Adafruit makes.

Search Videos

Related Content



Hi and welcome back to the Circuit Playground Express, online workshop in this section we're going to learn about Circuit Python, which is another way that you can program the Circuit Playground Express.

Now Circuit Python is based on the Python programming language which is the most taught programming language in the world right now and Circuit Python is taking Python and added support for hardware one of the cool things about Circuit Python is you don't need a compiler to create your code you can edit it in just the text editor, you save that is the writes have a file name on your Circuit Playground and when you boot up your Playground it recognizes it as code and runs your program. So even though you don't need an editor to create code with Circuit Python, it's still nice to have one because you have added features like a serial monitor and error checking.

So, the editor that I recommend when using Circuit Python is MU which is spelled MU and it's created with out of fur products in mind. So, it's got direct Circuit Python compatibility it recognizes your Circuit Playground Express connected to your computer automatically and will save your code directly to the board. So, when you reboot it comes up right away and you can use as a great repl in it which allows you to create programs in real time directly off your board, which is great for troubleshooting your programs as you're making them. So, let's look at MU.

I've got it up here it's a very simple interface but it allows you to open load and save programs from your Circuit Playground Express there's the repl monitor, which is a serial monitor and a live coding interface for your board and it has a nice error checking option which will flag any errors in your program if you're running into problems. Now Circuit Python has a ton of libraries that are available for the Circuit Playground Express, which it makes it really easy to use the code and what I like about using it is that it just looks so clean there's no brackets anywhere we have our libraries here at the top we have our code contained in a while true loop and everything within that loop is indented one space. So rather than using brackets to contain our blocks of code the Circuit Python uses indents and indents are a normal thing to keep your code organized usually but it doesn't have any impact on how the codes run but in Circuit Python the indent is what delineates what falls into each action item.

So there is a disadvantage to using Circuit Python over say Arduino and that's since there is no compiler it takes a little bit longer for your board to run your code so because it's got to think about each line item as it comes across it so this isn't usually noticeable in many programs but if you're doing something really complex then you may notice that a Circuit Python program runs just a little bit slower than our than one written in Arduino but other than that it's a great programming language it's fun to use and for many projects that you make is more than fast enough.

So if you want to learn more about programming with Circuit Python head over to our tutorials section for the Circuit Playground Express, I've got lots of tutorials over there for programming in Circuit Python we've got example programs for using every sensor on the Circuit Playground Express as well as how to set up your board to program with it and where to get things like the editor MU stick around in the next section we'll talk about programming with Arduino.