To connect via I2C you’ll need to first enable the interface on the Pi. This is done via raspi-config which can be run in a terminal window:
In the raspi-config user interface navigate to Interfacing Options >> I2C and answer the question "Would you like the ARM I2C interface to be enabled?" with . After the next reboot user pi will be able to use the I2C bus without root privileges.
If Python 3 has already been installed on the system, execute the command below to install pip3:
sudo apt -y install python3-pip
If pip3 has already been installed on the system, execute the command below to install power-api
pip3 install power-api
Use the following command to uninstall the library:
pip3 uninstall power-api
Use the following command to upgrade the library to the latest:
pip3 install power-api --upgrade
All the methods can be accessed from the API doc.
Here's a list of example actions that you can do using the Python API:
One of the simple ways to use the Python API is to use the Python Interpreter.
Updated about 2 months ago