light_sensor.py 文件源码

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

项目:infilcheck 作者: jonnykry 项目源码 文件源码
def light_sense():

    count = 0

    #Output on the pin for 
    GPIO.setup(pin_to_circuit, GPIO.OUT)
    GPIO.output(pin_to_circuit, GPIO.LOW)
    time.sleep(0.1)

    #Change the pin back to input
    GPIO.setup(pin_to_circuit, GPIO.IN)

    #Count until the pin goes high
    while (GPIO.input(pin_to_circuit) == GPIO.LOW):
        count += 1

    if (count > 3000):
        led5_on()
        return count
    else:
        led5_off()
        return count
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号