So, i got this snes-like case for my raspi and it has functional buttons that turns off the raspi safely by using a python script. What i want to do is change the way the LED blinks as it is turning off from a on-off loop to a gradual blink using PWM. I already tested a simple script to see if it was possible and it worked:
Code:
import RPi.GPIO as IO
import time
IO.setwarnings(False)
IO.setmode (IO.BCM)
IO.setup(14,IO.OUT)
p = IO.PWM(14,100)
p.start(0)
while 1:
for x in range (100):
p.ChangeDutyCycle(x)
time.sleep(0.005)
for x in range (100):
p.ChangeDutyCycle(100-x)
time.sleep(0.005)
gpio.clean()
exit()
Pin 14 is the LED pin.
I tried inserting this code it into the script that handles the buttons and shutting down the system but nothing changes, it still blinks the same as before.
This is the script in question, and the blinking is handled at line 34.
The system i'm using is Recalbox.
Thanks in advance.