Equipment/VinylCutterOld: Difference between revisions
From London Hackspace Wiki
570 bytes removed
, 20 August 2010
|
|
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==
| | See http://github.com/muz/Ruby-PNC950 |
| | |
| 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
| |