Python module to use ADXL345.
Project description
ADXL345
=======
Python module to use ADXL345. Compatible with Python 2 and Python 3.
Based on [pimoroni/adxl345-python](https://github.com/pimoroni/adxl345-python).
## Install
Install it as a dependency using pip:
``` bash
pip install adxl345
```
## Usage
- Import module and instantiate an ADXL345
``` python
from adxl345 import ADXL345
adxl345 = ADXL345()
```
- Get 3-axis accelerations in m.s-²
``` python
axes = adxl345.get_axes()
# Returns something like:
# axes['x'] => -0.1614
# axes['y'] => 0.0691
# axes['z'] => 9.8064
```
- Get 3-axis accelerations in g (Earth gravity)
``` python
axes = adxl345.get_axes(True)
# Returns something like:
# axes['x'] => -0.0014
# axes['y'] => 0.0001
# axes['z'] => 1.0012
```
- Use another IC2 address
By default, this library uses the `0x53` I2C address.
To use another address, set it when creating an instance of ADXL345:
``` python
adxl345 = ADXL345(0x1D)
```
## Full example
``` python
from adxl345 import ADXL345
adxl345 = ADXL345()
axes = adxl345.get_axes(True)
# Returns something like:
# axes['x'] => -0.0014
# axes['y'] => 0.0001
# axes['z'] => 1.0012
```
## License
This project is under [MIT](LICENSE) license.
=======
Python module to use ADXL345. Compatible with Python 2 and Python 3.
Based on [pimoroni/adxl345-python](https://github.com/pimoroni/adxl345-python).
## Install
Install it as a dependency using pip:
``` bash
pip install adxl345
```
## Usage
- Import module and instantiate an ADXL345
``` python
from adxl345 import ADXL345
adxl345 = ADXL345()
```
- Get 3-axis accelerations in m.s-²
``` python
axes = adxl345.get_axes()
# Returns something like:
# axes['x'] => -0.1614
# axes['y'] => 0.0691
# axes['z'] => 9.8064
```
- Get 3-axis accelerations in g (Earth gravity)
``` python
axes = adxl345.get_axes(True)
# Returns something like:
# axes['x'] => -0.0014
# axes['y'] => 0.0001
# axes['z'] => 1.0012
```
- Use another IC2 address
By default, this library uses the `0x53` I2C address.
To use another address, set it when creating an instance of ADXL345:
``` python
adxl345 = ADXL345(0x1D)
```
## Full example
``` python
from adxl345 import ADXL345
adxl345 = ADXL345()
axes = adxl345.get_axes(True)
# Returns something like:
# axes['x'] => -0.0014
# axes['y'] => 0.0001
# axes['z'] => 1.0012
```
## License
This project is under [MIT](LICENSE) license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
adxl345-1.0.2.tar.gz
(2.2 kB
view details)
File details
Details for the file adxl345-1.0.2.tar.gz.
File metadata
- Download URL: adxl345-1.0.2.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b1abe2ed4b4a79f27a37f944d2c851b78c22f8e8abe348c8d50d2653cc81421
|
|
| MD5 |
91711bf2dc3312f850ba6b0ca119dc2f
|
|
| BLAKE2b-256 |
9775dd4f8e46eaa5b1257279fc600c4ef4c12066617d96d1c4579c7cf447c545
|