gpio2osc.py 文件源码

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

项目:pipypd 作者: stressfm 项目源码 文件源码
def RCtime (PiPin):
    measurement = 0
    # Discharge capacitor
    GPIO.setup(PiPin, GPIO.OUT)
    GPIO.output(PiPin, GPIO.LOW)
    time.sleep(0.1)

    GPIO.setup(PiPin, GPIO.IN)
    # Count loops until voltage across
    # capacitor reads high on GPIO
    start = time.time()
    while (GPIO.input(PiPin) == GPIO.LOW):
        measurement += 1

    end = time.time()
    # print end - start
    # return measurement
    return str(end - start)

# Connects the socket
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号