sample_pwm.py 文件源码

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

项目:raspberry-gpio-emulator 作者: nosix 项目源码 文件源码
def main():
    import RPi.GPIO as GPIO
    import time

    GPIO.setmode(GPIO.BCM)
    GPIO.setup(12, GPIO.OUT)
    p = GPIO.PWM(12, 50)
    try:
        p.start(0)
        for dc in range(0, 101, 5):
            p.ChangeDutyCycle(dc)
            time.sleep(0.1)
        for dc in range(100, -1, -5):
            p.ChangeDutyCycle(dc)
            time.sleep(0.1)
    finally:
        p.stop()
        GPIO.cleanup()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号