Metadata-Version: 2.1
Name: hx711-gpiozero
Version: 0.0.3
Summary: A HX711 Driver
Home-page: https://github.com/cyrusn/hx711_gpiozero
Author: CyrusN
Author-email: cyrusncy@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown

# HX711 driver library

## Description

This library allows to drive a HX711 load cess amplifier with a Raspberry Pi by using `gpiozero` library.
- to set channel and gain
- to read raw value

*This package requires `gpiozero` to be installed in Python 3.*

## Example

```py

from hx711_gpiozero import HX711
from time import sleep

spi = HX711()
print("Initiatin ...")
init_reading = spi.value

sleep(1)
input("Put a known mass on the scale, then press `enter`.")

try:
    rel_weight = float(input("What is the weight of the known mass?\n"))
except ValueError as err:
    print(err)
    print("(The input of weight can only be numbers)")
    exit(1)
rel_reading = spi.value
scale_ratio = rel_weight / (rel_reading - init_reading)

sleep(1)
while True:
    weight = (spi.value - init_reading) * scale_ratio
    print(weight)
    sleep(1)
```


