For an automation project I'm hooking my catfeeder-system up to a webserver. I've got the server running and by using shell_exec() in the php file, I can execute .py scripts.
However, as soon as the script needs to control GPIO functions, the script stops working (or at least, I don't see any new output and the connected LEDs aren't doing anything. Yes, my catfeeder-system needs LEDs
Code: Select all
def fadeInRed():
print("fadeInRed().")
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12, GPIO.OUT)
p = GPIO.PWM(12, 50) # channel=12 frequency=50Hz
p.start(0)
for dc in range(0, 101, 8):
p.ChangeDutyCycle(dc)
time.sleep(0.3)
time.sleep(1)
p.ChangeDutyCycle(0)
p.stop()
GPIO.cleanup()Does GPIO need special permissions perhaps? The script works fine when executed by ssh or by fysical button.