Sha256: 6b3295a63412554bda8b7ab3090ef272922be9b8cf79d592d3ea408c8bbf27b0

Contents?: true

Size: 444 Bytes

Versions: 1

Compression:

Stored size: 444 Bytes

Contents

#!/usr/bin/env ruby

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

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

x = ARGV[0].to_f
r = (0..100)

unless r.include?(x)
  STDERR.puts "#{x} is not within the acceptable range of #{r}"
  exit 1
end

char = ARGV[1] || '#'

bar = char * (x / 100 * display.cols)
clean_bar = sprintf('%-1$*2$s', bar, display.cols)
display.text(clean_bar, 0)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
i2c-ss1602-0.0.2 bin/bargraph