Need help with Ruby serial port

I need to make some messages through the serial port in Ruby. From my research, apparently, there are not many modern libraries for serial communication, and the latest material that I can find is from 2006. Are there any gems that I don't know about?

I ultimately need to keep in touch with a serial device connected to USB (I can understand that the port is not a problem) for feedback and fourth communication like this (somewhat pseudo-code Ruby-esque).

def serial_write_read if serial.read == "READY" serial.write "1" until serial.read == "OK" serial.write "5" end return when serial.read == "DONE" end end 
+4
ruby serial-port communication
Oct 03 '08 at 16:58
source share
3 answers

The serial port specification has not changed forever, I would not worry about how many years in the libraries.

I assume you saw this 2006 article on ruby ​​and serial ports

Here is someone who got the Ruby-SerialPort library mentioned there for working with poppies this year.

There's also this old post from ruby ​​talk about interacting with the Win32 Serial API.

+2
Oct 03 '08 at 18:05
source share

Just because searching for ruby-serialport will sometimes lead you here:

toholio github repo is no longer working (as of 09/2010). Published gem comes from

http://github.com/hparra/ruby-serialport

+3
Sep 28 '10 at 10:53 on
source share

While the serial standard has not changed, the way Ruby Gems interacts with Ruby C extensions has changed so much in recent years that the RubyForge serial port extension will not work well. There were some fixes on RubyForge over the years, but it was ugly. The great news is that Github has unbelievably speed up the work of cleaning up the Ruby serial port extension. At least three different people cross-fork their serial port code on Github. You can search on Github, but I believe that Toholio has the latest code that transcodes and repackages the serial port of Ruby as a Ruby Gem. (Yes!)

http://github.com/toholio/ruby-serialport/tree/master

It works great for me on Linux, resolving a previous conflict with the latest version of Ruby Gems. On Windows, I still have a problem with the job. Compiling Ruby extensions on Windows is never very simple, but it is the whole "fly" of worms. I'm just glad people are working on Ruby serial port support again. I asked Toholio to create a Windows binary stone that would solve all the problems, and he says that it is on his list.

+1
Oct 27 '08 at 23:06
source share



All Articles