SergeyPiskunov / micropython-hx711

Micropython driver for HX711 24-Bit Analog-to-Digital Converter
MIT License
79 stars 24 forks source link

micropython-hx711

Micropython driver for the HX711 24-Bit Analog-to-Digital Converter

Latest version supports:

Example for the ESP8266:

D_OUT pin is connected to the GPIO 5
PD_SCK pin is connected to the GPIO 4
Using internal HX711 oscillator, so ESP8266's frequency is set to 160000000

>>> from machine import freq
>>> freq(160000000)
>>> 
>>> from hx711 import HX711
>>> 
>>> driver = HX711(d_out=5, pd_sck=4)
>>> driver
HX711 on channel A, gain=128
>>> driver.read()
74342
>>> 
>>> driver.channel=HX711.CHANNEL_A_64
>>> driver.channel
('A', 64)
>>> driver.read()
36328
>>> 
>>> driver.power_off()