Raspberry Pi3 GPIO tx/rx status led

For anyone looking at using Raspberry pi Gpio pins for Led status this what i did to get it to work.

Go to and open using winSCP
/etc/rc.local
under /usr/local/etc/rc.allstar
type in /etc/asterisk/local/write_gpio.sh (makes gpio pins go to output upon startup)
then save

then type nano /etc/asterisk/local/write_gpio.sh
then type the following script

#!/bin/bash
#script name - write_gpio
gpio mode 7 out ; makes gpio 7 pin 7 an output
gpio mode 2 out ; makes gpio 2 pin 13 an output

save
make executable by chmod +x write_gpio.sh
open rpt.conf in asterisk folder and under events ad the following
sudo /usr/local/sbin/7high.sh = s|t|RPT_TXKEYED
sudo /usr/local/sbin/7low.sh = s|f|RPT_TXKEYED
sudo /usr/local/sbin/2high.sh = s|t|RPT_RXKEYED
sudo /usr/local/sbin/2low.sh = s|f|RPT_RXKEYED

save
under /usr/local/sbin/
create 4 scripts
7high.sh inside each script put #!/bin/bash next line put gpio write 7 1
7low.sh inside each script put #!/bin/bash next line put gpio write 7 0
2high.sh inside each script put #!/bin/bash next line put gpio write 2 1
2low.sh inside each script put #!/bin/bash next line put gpio write 2 0

save each one and make them executable using the chmod +x command

then reboot
and enjoy.

1 Like