import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12, GPIO.OUT)

p = GPIO.PWM(12, 50)  # channel=12 frequency=50Hz
p.start(0)
try:
    while 1:
        for dc in range(9, 20, 1):
            p.ChangeDutyCycle(dc)
            time.sleep(0.1)
	    print dc
        for dc in range(20, 9, -1):
            p.ChangeDutyCycle(dc)
            time.sleep(0.5)
	    print dc
except KeyboardInterrupt:
    pass
p.stop()
GPIO.cleanup()

