en:essais_des_sorties_relais

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:essais_des_sorties_relais [2016/01/27 21:15]
en:essais_des_sorties_relais [2020/07/05 17:13] (current)
Line 1: Line 1:
 +==== Configuration of the Outputs of the control relays ====
 +File ''/etc/rc.local''
 +Edit the file with the command (Add this code at the end of the file just BEFORE "exit 0")
  
 +<code bash>
 +sudo nano /etc/rc.local
 +</code>
 +<code bash>
 +#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
 +</code>
 +
 +==== Tests of the Outputs of the control relays ====
 +
 +You can verify the correct functioning of the outputs of the relays with the following code
 +<code bash>
 +sudo nano test-relays.sh
 +</code>
 +
 +<code bash | 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
 +
 +
 +</code>
 +
 +For running the code
 +<code bash>
 +sudo python test-relays.sh
 +</code>
 +
 +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
 +==== Configuration of the Outputs of the control relays ====
 +File ''/etc/rc.local''
 +Edit the file with the command (Add this code at the end of the file just BEFORE "exit 0")
 +
 +<code bash>
 +sudo nano /etc/rc.local
 +</code>
 +<code bash>
 +#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
 +</code>
 +
 +==== Tests of the Outputs of the control relays ====
 +
 +You can verify the correct functioning of the outputs of the relays with the following code
 +<code bash>
 +sudo nano test-relays.sh
 +</code>
 +
 +<code bash | 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
 +
 +
 +</code>
 +
 +For running the code
 +<code bash>
 +sudo python test-relays.sh
 +</code>
 +
 +{{youtube>jdAb_zyPq0k?medium}}