'''
https://github.com/SergeyPiskunov/micropython-hx711
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

https://github.com/robert-hh/hx711
https://github.com/akshayvernekar/HX711_IDF
'''
'''
from machine import freq
freq(160000000)
from hx711 import HX711
driver = HX711(d_out=34, pd_sck=4)
print(driver.read())
driver.channel=HX711.CHANNEL_A_64
print(driver.channel)

print(driver.read())
#driver.power_off()
'''
'''
import machine,time
servo = machine.PWM(machine.Pin(23), freq=50)
for i in range(360):
    servo.duty(i)
    time.sleep_ms(10)
'''

from hx711 import HX711
hx = HX711(d_out=34, pd_sck=4)

xvar=0;

while True:
    hx.tare()
    read    =   hx.read()
    average =   hx.read_average()
    value   =   hx.make_average()
    if xvar ==0:
        xvar    =   value
    output  =   float(value)    -   float(xvar)
    print('loop 5:',read)
D0D1D2D3D4D5D6D7GNDLOGIC