hx711.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:HX711 作者: gandalf15 项目源码 文件源码
def set_gain_A(self, gain):
        if gain == 128:
            self._gain_channel_A = gain
        elif gain == 64:
            self._gain_channel_A = gain
        else:
            raise ValueError('gain has to be 128 or 64.\nI have got: '
                        + str(gain))
        # after changing channel or gain it has to wait 50 ms to allow adjustment.
        # the data before is garbage and cannot be used.
        self._read()
        time.sleep(0.5)
        return True

    ############################################################
    # zero is function which sets the current data as      #
    # an offset for particulart channel. It can be used for    #
    # subtracting the weight of the packaging.         #
    # max value of times parameter is 99. min 1. Default 10.   #
    # INPUTS: times # how many times do reading and then mean  #
    # OUTPUTS: BOOL     # if True it is OK         #
    ############################################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号