Equipment/VinylCutterOld: Difference between revisions
From London Hackspace Wiki
no edit summary
No edit summary |
|||
Line 20: | Line 20: | ||
It should be possible to enable the serial port as a printer and print direct to it, but I found this produced cutter errors (flashing power light) and no cut. | It should be possible to enable the serial port as a printer and print direct to it, but I found this produced cutter errors (flashing power light) and no cut. | ||
The following file was generated by | The following file was generated by inkscape for a star shape. This almost works : the first leg is replaced by a poorly cut arc. May imply a need for some sort of initialisation data. | ||
IN; | IN; | ||
Line 63: | Line 63: | ||
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 "serialport" | |||
if (!ARGV[0]) | |||
puts "Yo dawg, I need a file." | |||
exit | |||
end | |||
plotter = SerialPort.new("/dev/ttyUSB2") | |||
plotter.baud=(9600) | |||
plotter.flow_control=(SerialPort::HARD) | |||
plotter.rts=(1) | |||
plotter.data_bits=(8) | |||
plotter.stop_bits=(1) | |||
begin | |||
File.open(ARGV[0], "r") do |inFile| | |||
while (line = inFile.gets) | |||
puts line | |||
plotter.write(line) | |||
# sleep(1) | |||
end | |||
end | |||
rescue | |||
puts "Failed to open #{ARGV[0]}" | |||
exit | |||
end |