LIS3DH Accelerometer I2C Driver for Python3
LIS3DH is an accelerometer manufactured by ST Microelectronics. With this driver, you can use LIS3DH with Python3 over I2C.
Dependencies
Only smbus2 other than Python.
Installation
pip3 install lis3dh
Usage
From command line;
run-lis3dh
From Python script;
from lis3dh import LIS3DH, device
from time import sleep
registers = device()
lis = LIS3DH(port=1, scale=registers.CTRL_REG4.SCALE_4G, data_rate=registers.CTRL_REG1.ODR_10Hz)
data = lis.read_dummy_register()
print("DUMMY REG CHECK ERROR: " + str(data)) # 0: No Error, -1: Error
lis.enable_axes(registers.CTRL_REG1.Xen | registers.CTRL_REG1.Yen | registers.CTRL_REG1.Zen)
while lis.read_data_ready_register() == lis.ERROR:
sleep(0.25)
data = lis.read_all_axes()
print("x(g): {}, y(g): {}, z(g): {}".format(data[0], data[1], data[2]))
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Metadata
Release files for lis3dh 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lis3dh-0.2.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lis3dh-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.1 kB
Release files / lis3dh-0.2.tar.gz
| Download URL | lis3dh-0.2.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77bc6f02a14b9fd959664e396caa784be1c1e6bd4ab767c7e802d4ca9460e203
|
|
BLAKE2b-256 checksum How to use checksums |
9fbb0b92e38f3873ac88519a42405c49aabb10ebbacfd9eff8d5ddde437641ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3
|
Release files / lis3dh-0.2-py3-none-any.whl
| Download URL | lis3dh-0.2-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70ed393c641c36e40d7ba7dc04bc02294025ee39324ee67a4636cf0bb6a3fe66
|
|
BLAKE2b-256 checksum How to use checksums |
891ef983bdb23296082848c0d490a62ef326b63ad700dfd86cd97b94db7fe2bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3
|