Sha256: 5889f003dfec6276718b8d0e15af3a8cdea84e2ff61fe1658147c2fac3333fe7
Contents?: true
Size: 622 Bytes
Versions: 2
Compression:
Stored size: 622 Bytes
Contents
require 'launchpad' device = Launchpad::Device.new on = { :red => :high, :green => :off } off = { :red => :off, :green => :lo } digit_map = [ [off, off, off, off], [on , off, off, off], [off, on , off, off], [on , on , off, off], [off, off, on , off], [on , off, on , off], [off, on , on , off], [on , on , on , off], [off, off, off, on ], [on , off, off, on ] ] while true do Time.now.strftime('%H%M%S').split('').each_with_index do |digit, x| digit_map[digit.to_i].each_with_index do |color, y| device.change :grid, color.merge(:x => x, :y => (7 - y)) end end sleep 0.25 end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
mrjoy-launchpad-0.4.0 | examples/binary_clock.rb |
launchpad-0.3.0 | examples/binary_clock.rb |