Python library for Seeedstudio Grove devices
Python library for Seeedstudio Grove Devices on embeded Linux platform, especially good on below platforms:
To operate grove sensors, the grove.py depends on the smbus2 hardware interface library.
For beginner or library user only, please install with online method.
For developer or advanced user, please install dependencies
and then install grove.py with source code.
Here is the compatibility of grove.py with Python2 and Python3 on each releases of Raspbian/Raspberry Pi OS.
Raspberry Pi OS Releases | grove.py for Python2 | grove.py for Python3 |
---|---|---|
9 (Stretch) | √ | √ |
10 (Buster) until 2020-08-20 | √ | √ |
10 (Buster) after 2020-08-20 | × | √ |
11 (Bullseye) | × | √ |
Because Python2 is obsolete and APT repository does not provide python-pip
, so the Raspberry Pi OS releases which after 10 (Buster) 2020-08-20
cannot use Online install
command. We also recommend using Python3 to all the users and developers.
install/update all dependencies and latest grove.py
curl -sL https://github.com/Seeed-Studio/grove.py/raw/master/install.sh | sudo bash -s -
From source code
git clone https://github.com/Seeed-Studio/grove.py
cd grove.py
# Python2 (This command line does not provide for Raspberrypi OS 10 (Buster) >= 2020-12-02)
sudo pip install .
# Python3
sudo pip3 install .
Basic GPIO Input & Output demo
import time
from grove.gpio import GPIO
led = GPIO(12, GPIO.OUT)
button = GPIO(22, GPIO.IN)
while True:
if button.read():
led.write(1)
else:
led.write(0)
time.sleep(0.1)
See more demos and how to run
click here
Check list for adding a new grove device, for simple, take grove_led as a example.
__all__ =
python <file>
and python3 <file>
console_scripts
list, take effect by install again