Feb-18-2021, 11:00 AM
My guess is you have to wait for the current duty cycle to complete. This should work to bring the light up and leave it on.
import RPi.GPIO as GPIO from time import sleep GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(11, GPIO.OUT) # Using PWM ramp power from 0 to 100% pwm=GPIO.PWM(11,100) pwm.start(0) for x in range(100): pwm.ChangeDutyCycle(x) sleep(0.01) pwm.stop() sleep(0.01) # Wait length of 1 duty cycle GPIO.output(11, GPIO.HIGH)When I was looking at the rpi stuff I remember reading the default PWM frequency is 1000Hz. I don't know why the examples set it at 100Hz.