24
edits
Line 50: | Line 50: | ||
There is a [[Pledges/Vinyl|pledge]] running for the purchase of more vinyl. | There is a [[Pledges/Vinyl|pledge]] running for the purchase of more vinyl. | ||
require "rubygems" | require "rubygems" | ||
require "serialport" | require "serialport" | ||
if (!ARGV[0]) | |||
puts "Yo dawg, I need a file." | |||
exit | |||
end | |||
begin | |||
inputFile = File.open(ARGV[0], "r") | |||
rescue | |||
puts "Failed to open #{ARGV[0]}" | |||
exit | |||
end | |||
serialData = inputFile.read | |||
if (serialData !=~ /^IN/) | |||
puts "That doesn't seem to be valid HPGL data." | |||
exit | |||
end | |||
plotter = SerialPort.new("/dev/ttyUSB2") | plotter = SerialPort.new("/dev/ttyUSB2") | ||
plotter.baud=(9600) | plotter.baud=(9600) | ||
Line 61: | Line 77: | ||
plotter.data_bits=(8) | plotter.data_bits=(8) | ||
plotter.stop_bits=(1) | plotter.stop_bits=(1) | ||
plotter.write(serialData) | plotter.write(serialData) |
edits