コード例 #1
0
 def __init__(self):
     self.config = LocalConfig()  # config init
     self.hx = HX711(5, 6)  # initialize scale
     self.ratio = 0  # scale ratio for calibration
     self.offset = 0
     self.value = 0
     self.result = 0
     self.data = 0
     if self.config.scale_calibrated:
         self.hx.set_offset(float(self.config.scale_offset))
         self.hx.set_scale(float(self.config.scale_ratio))
コード例 #2
0
ファイル: scale.py プロジェクト: breedwatch/monitoring-system
 def __init__(self):
     self.config = LocalConfig()  # config init
     self.hx = HX711(5, 6)  # initialize scale
     self.ratio = 0  # scale ratio for calibration
     self.offset = 0
     self.value = 0
     self.result = 0
     self.data = 0
     self.error = ErrorHandler()
     self.config.get_config_data()
     if self.config.scale["calibrated"]:
         self.hx.set_offset(float(self.config.scale["offset"]))
         self.hx.set_scale(float(self.config.scale["ratio"]))
コード例 #3
0
ファイル: scale.py プロジェクト: ramawardhanaa/samsi
 def __init__(self):
     self.config = Config()  # config init
     self.config_data = self.config.get_config_data()
     self.hx = HX711(5, 6)  # initialize scale
     self.is_calibrated = self.config_data['SCALE'].getboolean(
         "calibrated")  # check config if scale is calibrated
     self.ratio = 0  # scale ratio for calibration
     self.offset = 0
     self.value = 0
     self.result = 0
     self.data = 0
     if self.is_calibrated:
         self.hx.set_offset(float(self.config_data["SCALE"]['offset']))
         self.config_ratio = self.config_data["SCALE"][
             'ratio']  # get scale ratio of config
         self.hx.set_scale(float(self.config_ratio))
コード例 #4
0
 def __init__(self):
     self.config = Config()  # config init
     self.config_data = self.config.get_config_data()
     self.hx = HX711(dout_pin=5,
                     pd_sck_pin=6,
                     gain_channel_A=64,
                     select_channel='A')  # initialize scale
     self.is_calibrated = self.config_data['SCALE'].getboolean(
         "calibrated")  # check config if scale is calibrated
     self.ratio = 0  # scale ratio for calibration
     self.value = 0
     self.measure_weight = 0
     self.result = 0
     self.data = 0
     self.offset = 0
     if self.is_calibrated:
         self.hx._offset_A_64 = float(self.config_data["SCALE"]['offset'])
         self.config_ratio = self.config_data["SCALE"][
             'ratio']  # get scale ratio of config
         self.hx.set_scale_ratio(scale_ratio=float(self.config_ratio))