Thank you very much. I will be able to study this this evening. Do you advise me to make a new script or can I reuse the recalbox script?
Here is the script in question:
#!/bin/bash
LED1=22
LED2=27
cd /sys/class/gpio/
if [ -e /sys/class/gpio/export ]
then
echo "$LED1" > /sys/class/gpio/export
echo "$LED2" > /sys/class/gpio/export
fi
echo out > /sys/class/gpio/gpio$LED1/direction
echo 0 > /sys/class/gpio/gpio$LED1/value
echo out > /sys/class/gpio/gpio$LED2/direction
echo 1 > /sys/class/gpio/gpio$LED2/value
while true;
do retroarch=$(ps -ef | grep -E 'retroarch|mupen64plus' | grep -v "grep" | wc -l)
if [ $retroarch -eq 0 ]; # If retroarch is playing
then
echo 0 > /sys/class/gpio/gpio$LED1/value
echo 1 > /sys/class/gpio/gpio$LED2/value
else
echo 0 > /sys/class/gpio/gpio$LED2/value
echo 1 > /sys/class/gpio/gpio$LED1/value
fi
sleep 1
done