As we continue to develop CircuitPython and create new releases, we will stop supporting older releases. If you are running CircuitPython 2.x, you need to update to 3.x.
You need to download the CircuitPython Library Bundle that matches your version of CircuitPython. Please update to CircuitPython 3.x and then download the 3.x bundle.
We will soon stop providing the 2.x bundle as an automatically created download on the Adafruit CircuitPython Bundle repo. If you must continue to use 2.x, you can still download the 2.x version of
mpy-cross from the 2.x release of CircuitPython on the CircuitPython repo and create your own 2.x compatible .mpy library files. However, it is best to update to 3.x for both CircuitPython and the library bundle.
Many of the CircuitPython boards also run Arduino. But how do you switch between the two? Switching between CircuitPython and Arduino is easy.
If you're currently running Arduino and would like to start using CircuitPython, follow the steps found in Welcome to CircuitPython: Installing CircuitPython.
If you're currently running CircuitPython and would like to start using Arduino, plug in your board, and then load your Arduino sketch. If there are any issues, you can double tap the reset button to get into the bootloader and then try loading your sketch. Always backup any files you're using with CircuitPython that you want to save as they could be deleted.
That's it! It's super simple to switch between the two.
We often reference "Express" and "Non-Express" boards when discussing CircuitPython. What does this mean?
Express refers to the inclusion of an extra 2MB flash chip on the board that provides you with extra space for CircuitPython and your code. This means that we're able to include more functionality in CircuitPython and you're able to do more with your code on an Express board than you would on a non-Express board.
Express boards include Circuit Playground Express, ItsyBitsy M0 Express, Feather M0 Express, Metro M0 Express and Metro M4 Express.
Non-Express boards include Trinket M0, Gemma M0, Feather M0 Basic, and other non-Express Feather M0 variants.
CircuitPython runs nicely on the Gemma M0 or Trinket M0 but there are some constraints
Small Disk Space
Since we use the internal flash for disk, and that's shared with runtime code, its limited! Only about 50KB of space.
No Audio or NVM
Part of giving up that FLASH for disk means we couldn't fit everything in. There is, at this time, no support for hardware audio playpack or NVM 'eeprom'. Modules
bitbangio are not included. For that support, check out the Circuit Playground Express or other Express boards.
However, I2C, UART, capacitive touch, NeoPixel, DotStar, PWM, analog in and out, digital IO, logging storage, and HID do work! Check the CircuitPython Essentials for examples of all of these.
For the differences between CircuitPython and MicroPython, check out the CircuitPython documentation.
Python (also known as CPython) is the language that MicroPython and CircuitPython are based on. There are many similarities, but there are also many differences. This is a list of a few of the differences.
Python is advertised as having "batteries included", meaning that many standard libraries are included. Unfortunately, for space reasons, many Python libraries are not available. So for instance while we wish you could
numpy isn't available. So you may have to port some code over yourself!
Integers in CircuitPython
On the non-Express boards, integers can only be up to 31 bits long. Integers of unlimited size are not supported. The largest positive integer that can be represented is 230-1, 1073741823, and the most negative integer possible is -230, -1073741824.
As of CircuitPython 3.0, Express boards have arbitrarily long integers as in Python.
Floating Point Numbers and Digits of Precision for Floats in CircuitPython
Floating point numbers are single precision in CircuitPython (not double precision as in Python). The largest floating point magnitude that can be represented is about +/-3.4e38. The smallest magnitude that can be represented with full accuracy is about +/-1.7e-38, though numbers as small as +/-5.6e-45 can be represented with reduced accuracy.
CircuitPython's floats have 8 bits of exponent and 22 bits of mantissa (not 24 like regular single precision floating point), which is about five or six decimal digits of precision.
Differences between MicroPython and Python
For a more detailed list of the differences between CircuitPython and Python, you can look at the MicroPython documentation. We keep up with MicroPython stable releases, so check out the core 'differences' they document here.
These are some of the common questions regarding CircuitPython and CircuitPython microcontrollers.
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 (REPL).
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
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.
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
You can download the CircuitPython 2.x version of
mpy-cross for your operating system from the CircuitPython Releases page under the latest 2.x version.
You can build
mpy-cross for CircuitPython 3.x by cloning the CircuitPython GitHub repo, and running
make in the
circuitpython/mpy-cross/ directory. Then run
./mpy-cross path/to/foo.py to create a
foo.mpy in the same directory as the original file.
Will give you the number of bytes available for use.
No. CircuitPython does not currently support interrupts. We do not have an estimated time for when they will be included.
No. We are not currently developing for it. It will be pulled from MicroPython when development there for it is complete. We do not have an estimated time for when that will happen.
No, WINC1500 will not fit into the M0 flash space.