import RPi.GPIO as gpio
led_pin = 33
gpio.setmode(gpio.BOARD)
gpio.setup(led_pin, gpio.OUT)
pwm_led = gpio.PWM(led_pin, 500) # Create a PWM instance, first parameter is pin, second parameter is frequent.
pwm_led.start(100) # Start PWM, the parameter 100 here is duty cycle.
while True:
duty_s = raw_input("Enter Brightness (0 to 100)") # Get input.
# duty =100- int(duty_s) # change string to int.
pwm_led.ChangeDutyCycle(int(duty_s)) # Change the duty cycle to set the new duty cycle.