CircuitPython Programming Documentation¶
CircuitPython includes many individual modules as part of the application programming interface (API) to support different kinds of hardware and other standard computing algorithms. The details of each module are documented on separate pages indexed below.
Core CircuitPython Modules¶
The full set of documentation is available on the Adafruit CircuitPython - API Reference site.
Following is an index to the documentation of our most commonly used core modules:
CircuitPython board module: board specific pin names.
CircuitPython digitalio module: basic digital I/O.
CircuitPython pwmio module: pulse-width modulation (PWM) output, e.g. for motors and servos.
CircuitPython analogio module: analog I/O typically implemented with digital-to-analog (DAC) and analog-to-digital (ADC) converters.
CircuitPython busio module: serial protocols including I2C and SPI.
CircuitPython pulseio module: basic pulse I/O, e.g. for particular analog sensors.
CircuitPython neopixel_write module: low-level interface for driving one or more NeoPixel color LEDs.
CircuitPython ulab module: numerical array processing implementing a subset of numpy.
CircuitPython supervisor module: access to system state not specific to a given device.
The following modules implement a subset of standard Python:
CircuitPython time module: internal clock timing functions implementing a subset of the standard Python time module.
CircuitPython random module: pseudorandom number generators.
CircuitPython sys module: mostly platform parameters.
For devices with WiFi networking:
CircuitPython wifi module: low-level functionality for Wifi network communication.
CircuitPython socketpool module: network socket stream support.
CircuitPython Library Bundles¶
Additional optional libraries provide support for many specific devices. If you would like to use a specific sensor, display, or peripheral device in your project, there may already be a library to support it.
Each CircuitPython firmware release also includes a large bundle of compiled
library files. To install a library, you will need to download the library
bundle zip file matching your firmware, unpack it, then copy specific files into
the lib/ folder of your device CIRCUITPY drive.
The library bundle releases can be downloaded from CircuitPython Libraries.
A good place to start looking for a device-specific libary is the Adafruit Sponsored Libraries and Drivers on GitHub page.
CircuitPython Library Modules¶
Following is an index to the documentation of our most commonly used optional modules:
CircuitPython adafruit_motor module: higher-level interface to control motors and servos using PWM outputs.
CircuitPython neopixel module: higher-level NeoPixel driver that presents a strip as a sequence.
Source Code Repositories¶
If you wish to delve deeply into the internals of either the core CircuitPython system or the libraries, the Adafruit github account hosts the source code. Note also that the API documentation frequently has source code links for inspecting the code.
- Adafruit CircuitPython Library Bundle (github).
Source code for the main Adafruit library bundle required for most examples. This is primarily a host module for submodules and refers to many other individual repositories.
- CircuitPython Community Library Bundle (github).
Source code for additional library support for interfacing to a wide variety of devices.
- CircuitPython (github).
Source code for the core language system itself, derived from MicroPython. It includes the C sources for the interpreter and compiler, the mpy-cross cross-compiler for creating .mpy files, and low-level hardware drivers for each target system.
- MicroPython (github).
Source code for the MicroPython system for embedded microcontrollers. Note that this upstream version supports a wider variety of microcontrollers than CircuitPython, notably including the ESP8266 which is no longer supported by CircuitPython.