Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- import time
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(5,GPIO.OUT)
- p=GPIO.PWM(5,50)
- p.start(0)
- try:
- while True :
- for x in range(0,101,5) :
- p.ChangeDutyCycle(x)
- time.sleep(0.1)
- for x in range(100,-1,-5) :
- p.ChangeDutyCycle(x)
- time.sleep(0.1)
- except KeyboardInterrupt:
- pass
- p.stop()
- GPIO.cleanup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement