hparra / ruby-serialport

ruby-serialport is a Ruby library that provides a class for using RS-232 serial ports
http://rubygems.org/gems/serialport
GNU General Public License v2.0
246 stars 58 forks source link

Using serialport prevents puts from writing to terminal? #67

Open sjalloq opened 6 years ago

sjalloq commented 6 years ago

Hi,

I've only just started playing with this but have been confused for an hour or so after trying to print debug information to the terminal I'm running my script from. When using any of the IO.read* methods, I don't get any output to my terminal when trying to print/puts.

I've setup a simple echo server with a virtual terminal and the script is working but fails to print anything to the terminal. What's going on?

require 'serialport'

NONE = 0

s = SerialPort.new(3,9600,8,1,NONE)

puts "Read timeout is set to '#{s.read_timeout}'"
puts "SerialPort params are: #{s.get_modem_params}"

while true do
  c = s.readline("\n")
  s.printf(c)
  puts c
end
sjalloq commented 6 years ago

So having tried this on OS X now, it seems to be an issue with using MSYS on Windows.