HX711.py 文件源码

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

项目:FoodBox_Hardware 作者: FatCatProject 项目源码 文件源码
def read(self):
        self.waitForReady()
        unsignedValue = 0

        for i in range(0, self.readBits):
            GPIO.output(self.PD_SCK, True)
            unsignedValue = unsignedValue << 1
            GPIO.output(self.PD_SCK, False)
            bit = GPIO.input(self.DOUT)
            if (bit):
                unsignedValue = unsignedValue | 1

        self.setChannelGainFactor()
        signedValue = self.correctForTwosComplement(unsignedValue)

        self.lastVal = signedValue
        return self.lastVal
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号