24
edits
No edit summary |
|||
Line 52: | Line 52: | ||
==Example code== | ==Example code== | ||
require "rubygems" | require "rubygems" | ||
require "serialport" | require "serialport" | ||
plotter = SerialPort.new("/dev/ttyUSB2") | plotter = SerialPort.new("/dev/ttyUSB2") | ||
plotter.baud=(9600) | plotter.baud=(9600) | ||
plotter.flow_control=(SerialPort::SOFT) | plotter.flow_control=(SerialPort::SOFT) | ||
plotter.rts=(1) | plotter.rts=(1) | ||
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;" | 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) |
edits