Playing with LEDs
Just made binary clock based on cron jobs and batch file.
Because there are only 6 LEDs, it's not bossible to show time with minutes. So I decided to use 4 LEDs for hours (1-12) and 2 LEDs for quaters.
I'm not a Linux guru, so correct me if it's possible o make it better.
M=`date +%M`
H=`date +%I`
echo 15 > /sys/class/leds/oxnas-wd810-leds\:ca/brightness;
echo 15 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
HH=`date +%H`
if [ $HH -ge '23' -o $HH -lt '07' ]; then
exit 0;
fi
sleep 1;
if [ $M -ge 15 -a $M -lt '30' ]; then
echo 9 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
if [ $M -ge 30 -a $M -lt '45' ]; then
echo 10 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
if [ $M -ge 45 -a $M -lt '60' ]; then
echo 9 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
sleep 1;
echo 10 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
sleep 1;
if [ $H == 01 ]; then
echo 11 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
if [ $H == 02 ]; then
echo 12 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
if [ $H == '03' ]; then
echo 11 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
sleep 1;
echo 12 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
if [ $H == '04' ]; then
echo 13 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
if [ $H == '05' ]; then
echo 11 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
sleep 1;
echo 13 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
if [ $H == '06' ]; then
echo 12 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
sleep 1;
echo 13 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
if [ $H == '07' ]; then
echo 11 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
sleep 1;
echo 12 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
sleep 1;
echo 13 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
if [ $H == '08' ]; then
echo 14 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
if [ $H == '09' ]; then
echo 11 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
sleep 1;
echo 14 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
if [ $H == '10' ]; then
echo 12 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
sleep 1;
echo 14 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
if [ $H == '11' ]; then
echo 11 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
sleep 1;
echo 12 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
sleep 1;
echo 14 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
if [ $H == '12' -o $H == '00' ]; then
echo 13 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
sleep 1;
echo 14 > /sys/class/leds/oxnas-wd810-leds\:st/brightness;
fi
I forced the capacity to be 15%, that I believe must be the 9th statuss, so I can use the first led too.
I made it to work only from 7AM to 11PM, because it's too bright in the night.
As you can see, photo has been taken at 8 and 3rd quater. OK, you might not see that, because of my phone cam, it looks like 9, 3rd quater.
I made the frame, because I can't see, which LED is on. This one helps a lot.
For those, who doesn't know binary:
00 - 0 (1st quater)
01 - 1 (2nd quater)
10 - 2 (3rd quater)
11 - 3 (4th quater)
0001 - 1
0010 - 2
0011 - 3
0100 - 4
0101 - 5
0110 - 6
0111 - 7
1000 - 8
1001 - 9
1010 - 10
1011 - 11
1100 - 12
This is just a toy, but it's fun to make this clock in cold atumn evening.
Have fun!