en:essais_des_sorties_relais

File /etc/rc.local Edit the file with the command (Add this code at the end of the file just BEFORE “exit 0”)

sudo nano /etc/rc.local
#RELAYS OUTPUTS
echo "20" > /sys/class/gpio/export &
sleep 2
echo out > /sys/class/gpio/gpio20/direction
echo "21" > /sys/class/gpio/export &
sleep 2
echo out > /sys/class/gpio/gpio21/direction
echo "22" > /sys/class/gpio/export &
sleep 2
echo out > /sys/class/gpio/gpio22/direction
echo "23" > /sys/class/gpio/export &
sleep 2
echo out > /sys/class/gpio/gpio23/direction

You can verify the correct functioning of the outputs of the relays with the following code

sudo nano test-relays.sh
| test-relays.sh
#!/bin/bash
# Sequence of testing the 4 relays
 
 for i in `seq 20 23`;
        do
                echo 1 > /sys/class/gpio/gpio$i/value
                sleep 1
        done
 for i in `seq 20 23`;
        do
                echo 0 > /sys/class/gpio/gpio$i/value
                sleep 1
        done
 
 for i in `seq 20 23`;
        do
                echo 1 > /sys/class/gpio/gpio$i/value
        done
 sleep 1
 for i in `seq 20 23`;
        do
                echo 0 > /sys/class/gpio/gpio$i/value
        done

For running the code

sudo python test-relays.sh

root@f5uii-serveur:/var/www/dwiki/data/pages/en# cp essais_des_sorties_relais.txt /tmp/essais_des_sorties_relais.txt root@f5uii-serveur:/var/www/dwiki/data/pages/en# cat /tmp/essais_des_sorties_relais.txt

File /etc/rc.local Edit the file with the command (Add this code at the end of the file just BEFORE “exit 0”)

sudo nano /etc/rc.local
#RELAYS OUTPUTS
echo "20" > /sys/class/gpio/export &
sleep 2
echo out > /sys/class/gpio/gpio20/direction
echo "21" > /sys/class/gpio/export &
sleep 2
echo out > /sys/class/gpio/gpio21/direction
echo "22" > /sys/class/gpio/export &
sleep 2
echo out > /sys/class/gpio/gpio22/direction
echo "23" > /sys/class/gpio/export &
sleep 2
echo out > /sys/class/gpio/gpio23/direction

You can verify the correct functioning of the outputs of the relays with the following code

sudo nano test-relays.sh
| test-relays.sh
#!/bin/bash
# Sequence of testing the 4 relays
 
 for i in `seq 20 23`;
        do
                echo 1 > /sys/class/gpio/gpio$i/value
                sleep 1
        done
 for i in `seq 20 23`;
        do
                echo 0 > /sys/class/gpio/gpio$i/value
                sleep 1
        done
 
 for i in `seq 20 23`;
        do
                echo 1 > /sys/class/gpio/gpio$i/value
        done
 sleep 1
 for i in `seq 20 23`;
        do
                echo 0 > /sys/class/gpio/gpio$i/value
        done

For running the code

sudo python test-relays.sh
  • en/essais_des_sorties_relais.txt
  • Last modified: 2020/07/05 17:13
  • (external edit)