Hello All I have a AllStar node using a raspberry pi 3b and was looking at using the GPIO pins on the RPi to send a tx and rx status to an rgb led. Any help would be great i have tried several ways but no success.
Hi Brett,
Welcome aboard our new community site.
Take a look at the app_rpt management system. Have it call a script that turns your LEDs on and off.
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.
Woohoo! Congratulations on using the app_rpt Event Management system. As far as I know, you are the first. That’s awesome!
I for many years have been using what seems like a complex event system, but it is really simple and works great and does exactly what I wanted it to do.
It lets the person who timedout the repeater and others, know when a timed out repeater has reset from a local timeout and it also prevents weather announcements from interrupting a QSO. We, 27383, are almost always permalinked with 27426. If the permalink is down the events script does cause error messages in the log, but everything still works fine. YMMV. If someone knows how to avoid the link down errorlog messages, please let me know.
Chuck
···
In the weather script, /usr/local/sbin/wx_condition.sh, just before “function round ()” I add a few lines like this
if [[ -f /tmp/key27383 ]]
then {
exit
} fi
if [[ -f /tmp/key27426 ]]
then {
exit
} fi
if [[ -f /tmp/qsoactive ]]
then {
exit
} fi
Then I create or edit all of the following files with the content just below the filename added to the appropriate place in the file.
/etc/asterisk/rpt.conf
[events]
TEMPVARAA = v|e|${RPT_ALINKS} =~ “”,27426[TRC]K""
/usr/local/bin/ericunkey.sh = s|f|TEMPVARAA
/usr/local/bin/erickey.sh = s|t|TEMPVARAA
/usr/local/bin/weunkey.sh = s|f|RPT_RXKEYED
/usr/local/bin/wekey.sh = s|t|RPT_RXKEYED
/usr/local/bin/wetxunkey.sh = s|f|RPT_TXKEYED
/usr/local/bin/wetxkey.sh = s|t|RPT_TXKEYED
I put all of my scripts in /usr/local/bin/
ericunkey.sh
#!/bin/sh
rm -f /tmp/key27426
erickey.sh
#!/bin/sh
touch /tmp/key27426
wekey.sh
#!/bin/sh
touch /tmp/key27383
/usr/local/bin/qsoactive.pl
weunkey.sh
#!/bin/sh
rm -f /tmp/key27383
if [ ! -f /tmp/txkey27383 ]
then {
/usr/bin/asterisk -rx “rpt localplay 27383 ha/reset”
} fi
wetxkey.sh
#!/bin/sh
touch /tmp/txkey27383
wetxunkey.sh
#!/bin/sh
rm -f /tmp/txkey27383
/usr/local/bin/qsoactive.pl
#!/usr/bin/perl
$now = time();
open($fh, “>”, “/tmp/qsoactive”)
or die “Can’t open > /tmp/qsoactive: $!”;
print $fh “$now\n”;
close($fh);
$then = $now + 180;
open($fh, “>”, “/tmp/qsoexpire”)
or die “Can’t open > /tmp/qsoexpire: $!”;
print $fh “$then\n”;
close($fh);
crontab -e
*/2 * * * * /usr/local/bin/qsoexpired.pl
0 6-22/2 * * * /usr/local/sbin/wx_condition.sh KBMI 27383
/usr/local/bin/qsoexpired.pl
#!/usr/bin/perl
use PortLocker;
my $port = 47262;
my $locker = new PortLocker;
if(! $locker->lock())
{
exit;
#— failed, port already locked
}
$now = time();
$then = $now + 10;
$qsoexpired = $then;
while($qsoexpired >= $now) {
sleep 17;
$qsoexpired = 0;
open($fh, “<”, “/tmp/qsoexpire”)
or die “Can’t open < /tmp/qsoexpire: $!”;
$qsoexpired = readline($fh);
close($fh);
$now = time();
}
unlink “/tmp/qsoactive”;
$locker->unlock();
2 posts were split to a new topic: Winscp as root user