Pimer - Raspberry Pi visual timer

This is an old driver based LedBorg script
We recommend using the new driver free based scripts for LedBorg.
The new driver free examples can be found here, the installation can be found here.

A simple script to use your Raspberry Pi and LedBorg as a visually indicating timer.

Timer runs as
./timer.sh delay
for example
./timer.sh 60
will turn the LedBorg to Green, delay for one minute, then flash the LedBorg Red

You can download the Pimer file as text here
To use, save this on the pi as pimer.sh

#!/bin/bash

# Check we have an input
if [ $# -eq 0 ]; then
	# No inputs given, display help ($0 is the scripts name)
	echo "Usage $0 delay"
	echo "e.g. $0 10 will time 10s then flash red"
else
	# Set on (green) and wait
	echo "020" > /dev/ledborg
	sleep $1

	# Flash red until user presses a key
	echo "Time's up!"
	echo "Press any key to finish"
	key=""
	while [ "$key" = "" ]; do
		# Set red and wait for 1 keypress (1 second timeout)
		echo "200" > /dev/ledborg
		read -n 1 -t 1 key

		# If no key was pressed set off and wait for 1 keypress (1 second timeout)
		if [ "$key" = "" ]; then
			echo "000" > /dev/ledborg
			read -n 1 -t 1 key
		fi
	done

	# Set off (we are now done)
	echo "000" > /dev/ledborg
fi
Subscribe to Comments for "Pimer - Raspberry Pi visual timer"