CircuitPython is a version of Python designed to run on tiny computers called microcontrollers. The Circuit Playground Express is a CircuitPython compatible microcontroller. CircuitPython is designed to make getting started with electronics and programming super simple.
CircuitPython looks for a file called
code.py, and runs the code within automatically. It makes getting started quite straightforward. CircuitPython also allows you to connect to a serial REPL which provides you with a way to see your code working live as you save your files. It also provides you with a prompt where you can enter lines of code and execute them immediately.
In this part of the guide, we're going to cover how to get CircuitPython installed on your Circuit Playground Express and you'll write a little CircuitPython yourself!
Installing CircuitPython is simple. Follow the instructions found on the CircuitPython page of the Adafruit Circuit Playground Express guide. It includes a few easy steps to get you going with CircuitPython. Once you've finished installing it, head back here to continue.
Congratulations on installing CircuitPython onto your Circuit Playground Express! Way to go!
The Circuit Playground library and all libraries it depends on are built into CircuitPython for the Circuit Playground Express. This means you don't need to load any libraries to use it!
CircuitPython sends data to the computer connected to the Circuit Playground Express. You can see the output of print statements and any errors you encounter along the way by connecting to the serial REPL.
To get started with the serial REPL, check out the tutorial here: Serial Console (REPL). There are links in that guide that cover setup on Mac, Linux and Windows.
Once you've gotten your serial connection, press
Ctrl+C then any key to enter the REPL. You should have a prompt that looks like this:
This is a Python prompt. Here you can type any python code and have it run.
Every programmer in every programming language starts with a piece of code that says, "Hello, World." We're going to say hello to something else. Next to that prompt, type:
Welcome to programming!
To learn more, take a look at the Introduction to Circuit Playground Express Circuit Python section. The guide covers all the basics and provides plenty of examples to try and learn from. Check it out!