Cant connect to serial port

I have a A/D converter board attached to a serial port that I access
though Ruby. The problem is that the program won’t connect to the serial
port unless I first connect to the port using Putty. I’d like to resolve
this issue so I can run the program automatically after a reboot. It
hangs when .new is called. I think it has to do with the flow control -
it needs to be None but I don’t see a way of setting that before calling
.new.

Also is there a way to programmically determine the COM port? I was COM3
and then suddenly changed to COM4.

The relevant code section is:

parameters = { “baud”=>9600,
“data_bits”=>8,
“stop_bits”=>1,
“parity”=>SerialPort::NONE}

com = 3
sp = SerialPort.new(com, parameters)
sp.flow_control = SerialPort::NONE

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs