Created
June 6, 2015 14:28
-
-
Save Ardakilic/b1cbd8d8d9c4d8752baf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import RPi.GPIO as GPIO | |
import time | |
GPIO.setmode(GPIO.BOARD) | |
PINNO = 7 | |
GPIO.setup(PINNO, GPIO.OUT) | |
p = GPIO.PWM(PINNO, 50) | |
p.start(0) | |
try: | |
while True: | |
for i in range(100): | |
p.ChangeDutyCycle(i) | |
time.sleep(0.02) | |
for i in range(100): | |
p.ChangeDutyCycle(100-i) | |
time.sleep(0.02) | |
except KeyboardInterrupt: | |
pass | |
p.stop() | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment