SparkFun Qwiic MCP4725 Python Package
This python package makes it easy to access all the features of the MCP4725 over an I2C connection. This includes writing voltage, outputting a waveform, writing EEPROM and more. The package includes six examples that demonstrate how to use the MCP4725's capabilities.
Installation
The first step to using this package is installing it on your system. The install method depends on the python platform. The following sections outline installation on Python, MicroPython and CircuitPython.
Python
PyPi Installation
The package is primarily installed using the pip3 command, downloading the package from the Python Index - "PyPi".
Note - the below instructions outline installation on a Linux-based (Raspberry Pi) system.
First, setup a virtual environment from a specific directory using venv:
python3 -m venv path/to/venv
You can pass any path as path/to/venv, just make sure you use the same one for all future steps. For more information on venv click here.
Next, install the qwiic package with:
path/to/venv/bin/pip3 install sparkfun-qwiic-mcp4725
Now you should be able to run any example or custom python scripts that have import qwiic_mcp4725 by running e.g.:
path/to/venv/bin/python3 example_script.py
MicroPython Installation
If not already installed, follow the instructions here to install mpremote on your computer.
Connect a device with MicroPython installed to your computer and then install the package directly to your device with mpremote mip.
mpremote mip install github:sparkfun/qwiic_mcp4725_py
If you would also like to install the examples for this repository, issue the following mip command as well:
mpremote mip install --target "" github:sparkfun/qwiic_mcp4725_py@examples
CircuitPython Installation
If not already installed, follow the instructions here to install CircUp on your computer.
Ensure that you have the latest version of the SparkFun Qwiic CircuitPython bundle.
circup bundle-add sparkfun/Qwiic_Py
Finally, connect a device with CircuitPython installed to your computer and then install the package directly to your device with circup.
circup install --py qwiic_mcp4725
If you would like to install any of the examples from this repository, issue the corresponding circup command from below. (NOTE: The below syntax assumes you are using CircUp on Windows. Linux and Mac will have different path seperators. See the CircUp "example" command documentation for more information)
circup example qwiic_mcp4725\qwiic_mcp4725_ex1_basic
circup example qwiic_mcp4725\qwiic_mcp4725_ex2_waveform
circup example qwiic_mcp4725\qwiic_mcp4725_ex3_write_eeprom
circup example qwiic_mcp4725\qwiic_mcp4725_ex4_read
circup example qwiic_mcp4725\qwiic_mcp4725_ex5_power_down
circup example qwiic_mcp4725\qwiic_mcp4725_ex6_fast_write