Ruby binary clock
As soon as I got my hands on the Pi, I knew I needed to exploit those GPIO pins and do something I'd never attempted before; light up some LEDs, whee!
The result of my hackery, Ruby RPi Binary Clock, uses WiringPi, Ruby and a copious amount of LEDs and jump leads to create a 14 LED binary clock that shows the hour, minutes and day of the week.
Fork Ruby RPi Binary Clock on Github
Read a more in-depth article about my experiences with Ruby on the RPi
Here's a snippet of the code:
# A small snippet from clock.rb
# showing the dec->binary conversion
@@mydays.each do |number,led|
if day >= number
Gpio.write(led,ON)
day = day - number
sleep(delay)
slept = slept + delay
end
break unless day > 0
end
« Back to index Posted on 2012-06-20 by Philip Howard