Monthly Archives: April 2014

#oggstreamer – UserInterface for optional LEDs

I just added a small but neat feature I want to include in the V1.0 of the OggStreamer firmware – it is a user interface that allows to control the optional LEDs on the right side of the device.

How it works – the main application (oggs_app) is creating a named pipe in the temporary directory, the name of the file is /tmp/userleds

so the following command will set the optional green led on


echo 1 > /tmp/userleds

you can send any parameter from 0 to 7 to /tmp/userleds. The parameter is interpreted as binary representation of the leds. 1 is the GREEN led, 2 is the YELLOW led, 4 is the RED led. 0 is all leds OFF and 7 is all leds ON

this feature unfolds its potential when you combine it with shell scripts – for example – everyone likes blinking LEDs.

#!/bin/sh
while [ 1 ]; do
  echo 7 > /tmp/userleds
  sleep 1
  echo 0 > / tmp/userleds
  sleep 1
done

But also more useful tasks can be done, for example monitoring whether an IPAddr can be pinged.

#!/bin/sh
while [ 1 ]; do
  ping -c 1 $1
  if [ "$?" == "1" ]; then
     #ping did not succed -> display RED Led
     echo 4 > /tmp/userleds
  else
     #ping did succed -> display GREEN Led
     echo 1 > /tmp/userleds
  fi
  sleep 10
done