These are some of the common questions regarding CircuitPython and CircuitPython microcontrollers.
We are no longer building or supporting the CircuitPython 6.x or earlier library bundles. We highly encourage you to update CircuitPython to the latest version and use the current version of the libraries. However, if for some reason you cannot update, here are the last available library bundles for older versions:
We dropped ESP8266 support as of 4.x - For more information please read about it here!
We do not support ESP32 because it does not have native USB.
We do support ESP32-S2, which has native USB.
If you'd like to include WiFi in your project, check out this guide on using AirLift with CircuitPython. For further project examples, and guides about using AirLift with specific hardware, check out the Adafruit Learn System.
There is preliminary support for asyncio starting with CircuitPython 7.1.0. Read about using it in the Cooperative Multitasking in CircuitPython Guide.
The status LED can tell you what's going on with your CircuitPython board. Read more here for what the colors mean!
Memory allocation errors happen when you're trying to store too much on the board. The CircuitPython microcontroller boards have a limited amount of memory available. You can have about 250 lines of code on the M0 Express boards. If you try to import
too many libraries, a combination of large libraries, or run a program with too many lines of code, your code will fail to run and you will receive a MemoryError
in the serial console.
Try resetting your board. Each time you reset the board, it reallocates the memory. While this is unlikely to resolve your issue, it's a simple step and is worth trying.
Make sure you are using .mpy versions of libraries. All of the CircuitPython libraries are available in the bundle in a .mpy format which takes up less memory than .py format. Be sure that you're using the latest library bundle for your version of CircuitPython.
If that does not resolve your issue, try shortening your code. Shorten comments, remove extraneous or unneeded code, or any other clean up you can do to shorten your code. If you're using a lot of functions, you could try moving those into a separate library, creating a .mpy of that library, and importing it into your code.
You can turn your entire file into a .mpy and import
that into code.py. This means you will be unable to edit your code live on the board, but it can save you space.
import
statements affect memory?
It can because the memory gets fragmented differently depending on allocation order and the size of objects. Loading .mpy files uses less memory so its recommended to do that for files you aren't editing.
You can make your own .mpy versions of files with mpy-cross
.
You can download mpy-cross
for your operating system from here. Builds are available for Windows, macOS, x64 Linux, and Raspberry Pi Linux. Choose the latest mpy-cross
whose version matches the version of CircuitPython you are using.
To make a .mpy file, run ./mpy-cross path/to/yourfile.py
to create a yourfile.mpy in the same directory as the original file.
Run the following to see the number of bytes available for use:
import gc
gc.mem_free()
No. CircuitPython does not currently support interrupts. We do not have an estimated time for when they will be included
CP or CPy = CircuitPython
CPC = Circuit Playground Classic
CPX = Circuit Playground Express
CPB = Circuit Playground Bluefruit