Equipment/VinylCutterOld: Difference between revisions

From London Hackspace Wiki

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.


==Example code==
  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)
serialData = "IN;SP1;PU3999,6429;PD2693,5186;PD929,5557;PD1707,3932;PD809,2369;PD2596,2606;PD3805,1269;PD4131,3042;PD5776,3778;PD4191,4636;PD3999,6429;PD3999,6429;"
   
   
  plotter.write(serialData)
  plotter.write(serialData)
24

edits