public
Created — forked from tenderlove/Rakefile

  • Download Gist
Rakefile
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
require 'usb'
require 'betabrite'
 
###
# Get a betabrite sign:
#
# http://www.betabrite.com/
# http://www.amazon.com/Brite-Prism-Moving-Message-Display/dp/B000MQAI72
#
# Install gems:
#
# $ gem install usb betabrite
#
# Run once:
#
# $ rake betabrite:reset betabrite:allocate betabrite:format
#
# Subsequent runs:
#
# $ rake betabrite:update SLOT0=foo SLOT1=bar
#
namespace :betabrite do
desc 'Reset sign memory'
task :reset do
BetaBrite::USB.new.reset!
end
 
desc 'Allocate memory slots'
task :allocate do
bb = BetaBrite::USB.new do |sign|
sign.allocate do |memory|
memory.text('A', 4096)
memory.string('0', 64)
memory.string('1', 140)
end
end
bb.write_memory!
end
 
desc 'Format the main screen'
task :format do
bb = BetaBrite::USB.new do |sign|
sign.stringfile('0') do
print string("hello").red
end
 
sign.stringfile('1') do
print string("world").green
end
 
sign.textfile do
hold
print stringfile("0")
print string ' '
print stringfile("1")
end
end
bb.write!
end
 
task :update do
BetaBrite::USB.new { |sign|
sign.stringfile('0') do
print string(ENV['SLOT0']).rgb('0000FF')
end
 
sign.stringfile('1') do
print string(ENV['SLOT1']).rgb('FFFFFF')
end
}.write!
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.