Python library for the L3GD20 I2C 3-axis gyroscope
Project description
l3gd20-python
Python library for the L3GD20 I2C 3-axis gyroscope
Usage
- Install the Python
smbusmodule for your platform (sudo apt install python-smbusfor Debian or Ubuntu Linux) pip install l3gd20-pythonsudo l3gd20_test
Example Code
import time
import smbus
import l3gd20
i2c_channel = 1
bus = smbus.SMBus(i2c_channel)
# Will raise OSError if device is not connected
device = l3gd20.L3GD20(bus)
# Set range, 250 degrees/second is default
# Supported:
# RANGE_250DPS
# RANGE_500DPS
# RANGE_2000DPS
device.set_range(l3gd20.RANGE_250DPS)
# Wait for gyro to stabilize
time.sleep(0.5)
while True:
# Returns x,y,z tuple with values in degrees/second
data = device.read()
print([round(v, 2) for v in data])
time.sleep(0.1)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
l3gd20-python-1.0.0.tar.gz
(2.8 kB
view details)
File details
Details for the file l3gd20-python-1.0.0.tar.gz.
File metadata
- Download URL: l3gd20-python-1.0.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6078a3121ffa361771efb766236ed5776390c2ac5663903318a874e505b434b
|
|
| MD5 |
74bcb7836b34eb81ed0f0499714a007c
|
|
| BLAKE2b-256 |
205565723357d61c92633059c962c2ea573ae17db7688ec1d2efe9e487da6d99
|