# Program description # hx711test02a.py tlfong01 2020oct27hkt2109 # System Config # Rpi4B 2GB Thonny python 3.7.3 # HX711 PyPi Library Install # pi@raspberrypi:~ $ date Tue 27 Oct 2020 09:14:01 PM HKT # pi@raspberrypi:~ $ pip3 install hx711 # Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple # Requirement already satisfied: hx711 in ./.local/lib/python3.7/site-packages (1.1.2.3) # *** Imports *** import RPi.GPIO as GPIO from datetime import datetime from hx711 import HX711 # *** System Setup *** print('Program hx711test02.py', 'tlfong01', str(datetime.now())[0:16]) print('Program Begins, ... ', 'tlfong01', str(datetime.now())[0:16]) # *** Debug print *** # *** GPIO setup) print(' Setting up GPIO, ...') GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.cleanup() # *** Create object hx711 module number01 *** hx711m01 = HX711(dout_pin = 15, # *** Originally pin 5, now pin 15 (RxD) pd_sck_pin = 14, # *** Originally pin 6, now pin 14 (TxD) channel = 'A', gain = 64 ) # *** Reset module *** print(' Resetting hx711 module, ...') hx711m01.reset() # *** Get raw results *** # raw_results = hex77m01.get_raw_data(num_measures = 3) # *** Cleaning up GPIO *** print(' Cleaning up GPIO, ...') GPIO.cleanup() print('Program Ends. ', 'tlfong01', str(datetime.now())[0:16]) # *** Debug print *** # *** End of program *** ''' Sample output >>> %Run hx777_test_02a.py Program hx711test02.py tlfong01 2020-10-27 22:27 Program Begins, ... tlfong01 2020-10-27 22:27 Setting up GPIO, ... Resetting hx711 module, ... Cleaning up GPIO, ... Program Ends. tlfong01 2020-10-27 22:28 >>> '''