PyBMA400/README.md
2025-05-24 12:23:08 +01:00

50 lines
1.1 KiB
Markdown

# PyBMA400
A Python library for the Bosch BMA400 accelerometer, providing easy access to accelerometer data and configuration.
## Installation
```bash
pip install pybma400
```
## Features
- Read acceleration data
- Read temperature data in Celsius
- Configure power modes, sampling rates, and ranges
- Low-level register access for advanced users
- Simple orientation detection functionality
## Requirements
- Python 3.6 or later
- Raspberry Pi or other Linux system with I2C enabled
- SMBus library (automatically installed as a dependency)
## Usage Example
```python
from pybma400 import BMA400
# Initialize the sensor
sensor = BMA400() # Default I2C bus=1, address=0x14
# Read acceleration data
x, y, z = sensor.acceleration
print(f"Acceleration: X={x:.2f}, Y={y:.2f}, Z={z:.2f} m/s²")
# Read temperature
temp = sensor.temperature
print(f"Temperature: {temp:.1f}°C")
# Configure the sensor
sensor.power_mode = BMA400.NORMAL_MODE
sensor.output_data_rate = BMA400.ACCEL_100HZ
sensor.acc_range = BMA400.ACC_RANGE_4 # ±4g range
```
## License
This project is licensed under the MIT License - see the LICENSE file for details.