Sha256: 731a8b3d571573f8a2cef3bb6502f22ad8ccec5b9d62b365439860c659f3118f

Contents?: true

Size: 482 Bytes

Versions: 1

Compression:

Stored size: 482 Bytes

Contents

#!/usr/bin/env ruby

#
# Sample use:
#
# TZ='Europe/Berlin' date "+%d.%m.%Y      %H:%M Uhr   24'C" | bin/lcd2004a
#

$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'i2c/drivers/lcd'

trap('INT'){
  exit
}

ARGF.binmode
txt = ARGF.read

d = I2C::Drivers::LCD::Display.new('/dev/i2c-1', 0x27)

# Spread text over lines
(0..(d.rows - 1)).each do |row|
  x0 = row * d.cols
  x1 = x0 + d.cols - 1

  output = (txt[x0..x1] || '').chomp
  d.text(output, row, true)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
i2c-lcd-0.0.4 bin/lcd