Fun script for GL-AR150: Knightrider's KIT effect

I actually do miss a forum for homemade scripts, mods, etc. Or is it just fine to place them on the existing forums?

I discovered the reset script at /etc/rc.buttons/reset actually should blink all the leds a few times before restarting the router. The scripts calls an incorrect path to the leds, but gave me an idea to create a seperate script to create a Knightrider’s KIT idea: Custom Knight rider intro 1 - Classic - YouTube

I created the script below. The script will also reproduce the KIT idea on the console screen.

You could place the following script at the home directory of the logged in user and saved it as kit.sh for example. Don’t forget to add execute rights to the script:

counter=0;
while true
do
	clear;
	let counter+=1;
	if [ $counter -eq 1 ]; then
                echo " ";
                echo "Count: $counter";
                echo "Press CTRL+C to end.";
                echo 0 > /sys/class/leds/gl_ar150:wan/brightness;
                echo 0 > /sys/class/leds/gl_ar150:lan/brightness;
                echo 0 > /sys/class/leds/gl_ar150:wlan/brightness;
	elif [ $counter -eq 2 ]; then
		echo " .";
		echo "Count: $counter";
		echo "Press CTRL+C to end.";
		echo 1 > /sys/class/leds/gl_ar150:wan/brightness;
		echo 0 > /sys/class/leds/gl_ar150:lan/brightness;
		echo 0 > /sys/class/leds/gl_ar150:wlan/brightness;
	elif [ $counter -eq 3 ]; then
		echo "   .";
		echo "Count: $counter";
		echo "Press CTRL+C to end.";
		echo 0 > /sys/class/leds/gl_ar150:wan/brightness;
		echo 1 > /sys/class/leds/gl_ar150:lan/brightness;
		echo 0 > /sys/class/leds/gl_ar150:wlan/brightness;
	elif [ $counter -eq 4 ]; then
		echo "      .";
		echo "Count: $counter";
		echo "Press CTRL+C to end.";
		echo 0 > /sys/class/leds/gl_ar150:wan/brightness;
		echo 0 > /sys/class/leds/gl_ar150:lan/brightness;
		echo 1 > /sys/class/leds/gl_ar150:wlan/brightness;
	elif [ $counter -eq 5 ]; then
                echo " ";
                echo "Count: $counter";
                echo "Press CTRL+C to end.";
                echo 0 > /sys/class/leds/gl_ar150:wan/brightness;
                echo 0 > /sys/class/leds/gl_ar150:lan/brightness;
                echo 0 > /sys/class/leds/gl_ar150:wlan/brightness;
	 elif [ $counter -eq 6 ]; then
                echo "     .";
                echo "Count: $counter";
                echo "Press CTRL+C to end.";
                echo 0 > /sys/class/leds/gl_ar150:wan/brightness;
                echo 0 > /sys/class/leds/gl_ar150:lan/brightness;
                echo 1 > /sys/class/leds/gl_ar150:wlan/brightness;
	elif [ $counter -eq 7 ]; then
                echo "   .";
                echo "Count: $counter";
                echo "Press CTRL+C to end.";
                echo 0 > /sys/class/leds/gl_ar150:wan/brightness;
                echo 1 > /sys/class/leds/gl_ar150:lan/brightness;
                echo 0 > /sys/class/leds/gl_ar150:wlan/brightness;
	elif [ $counter -eq 8 ]; then
                echo " .";
                echo "Count: $counter";
                echo "Press CTRL+C to end.";
                echo 1 > /sys/class/leds/gl_ar150:wan/brightness;
                echo 0 > /sys/class/leds/gl_ar150:lan/brightness;
                echo 0 > /sys/class/leds/gl_ar150:wlan/brightness;
		counter=0;
	else
		counter=0;
	fi
	sleep 1;
done

Maybe it could be a lot more efficient, but hey! It works! :wink:

To reset the leds to the state you configure them it would be easiest to re-apply the led settings at Luci I think.
If you did leave the IP of the GL-AR150 at the default 192.168.8.1 the URL would be http://192.168.8.1/cgi/bin/luci After logging in you can go to System> LED configuration. At the bottom click Save & apply.

This is my default configuration (WAN and LAN off when no cable connected, WAN and LAN on when cable connected, WLAN practically always on, all blinking on transmitting and recieving):
photo luci_config_leds_zpstm85adnb.png

1 Like

I shot a video with several LED effects. The Knightrider KIT effect is in it.
Watch the video here: Buttons, LED's, scripts, etc. Fun on GL iNET GL-AR150 - YouTube

Good. A video really helps!