from hx711 import HX711
# Define the pins used for the HX711 module
DOUT_PIN = 27
PD_SCK_PIN = 14
# Create an instance of the HX711 class
hx711 = HX711(DOUT_PIN, PD_SCK_PIN)
# Set the calibration factor for your load cell
CAL_FACTOR = 1000
# Tare the load cell
hx711.tare()
# Read the weight continuously
while True:
weight = hx711.read() / CAL_FACTOR
print("Weight: {} g".format(weight))
utime.sleep(1)