This website is written in Ruby using the Sinatra framework and hosted with Passenger / Nginx on the Raspberry Pi ( temporarily not on a Pi! ) assisted by Cloudflare and a dash of jsDelivr

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

    day = day - number

    slept = slept + delay


  break unless day > 0


« Back to index Posted on 2012-06-20 by