I want to use GPIO's to manage relays with Domoticz and my Orange Pi 5:
Orange Pi 5 GPIO:
Below the outputs I want to manage:
Warning: wiringPi use wPi# but sysfs use GPIO#
That's the trick...
Go to domoticz home directory /home/domoticz or pi or dietpi etc.
- Create a script named sysfs.sh (or what ever) in domoticz directory
~$nano ~/domoticz/sysfs.sh
- Add this:
#! /bin/sh
#-----------------------------------------------------------------------------
# Init sysfs GPIO ports
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# unexport if needed
#
#echo 6 > /sys/class/gpio/unexport
#echo 9 > /sys/class/gpio/unexport
#echo 10 > /sys/class/gpio/unexport
#echo 13 > /sys/class/gpio/unexport
#echo 15 > /sys/class/gpio/unexport
#echo 16 > /sys/class/gpio/unexport
#-----------------------------------------------------------------------------
# export
#
echo 29 > /sys/class/gpio/export
echo 59 > /sys/class/gpio/export
echo 58 > /sys/class/gpio/export
echo 35 > /sys/class/gpio/export
echo 52 > /sys/class/gpio/export
echo 92 > /sys/class/gpio/export
#-----------------------------------------------------------------------------
# Set direction = out
#
echo out > /sys/class/gpio/gpio29/direction
echo out > /sys/class/gpio/gpio59/direction
echo out > /sys/class/gpio/gpio58/direction
echo out > /sys/class/gpio/gpio35/direction
echo out > /sys/class/gpio/gpio52/direction
echo out > /sys/class/gpio/gpio92/direction
#-----------------------------------------------------------------------------
# Set active_low = 0 (false)
#
echo 0 > /sys/class/gpio/gpio29/active_low
echo 0 > /sys/class/gpio/gpio59/active_low
echo 0 > /sys/class/gpio/gpio58/active_low
echo 0 > /sys/class/gpio/gpio35/active_low
echo 0 > /sys/class/gpio/gpio52/active_low
echo 0 > /sys/class/gpio/gpio92/active_low
#-----------------------------------------------------------------------------
# Set edges = none if needed
#
# echo none > /sys/class/gpio/gpio4/edge
#-----------------------------------------------------------------------------
# Set pullups if needed
#
# raspi-gpio set 4 pu
# raspi-gpio set 11 dl
# raspi-gpio set 12 dl
#-----------------------------------------------------------------------------
Aucun commentaire:
Enregistrer un commentaire