Ruby/SerialPort
Description
Ruby/SerialPort is a Ruby library that provides a class for using RS-232 serial ports. This class also contains low-level functions to check and set the current state of the signals on the line.
It support POSIX (Linux, *BSD, Solaris, AIX, Mac OS X), Cygwin and native Windows. The native Windows version of this library supports Microsoft’s Visual C++ and Borland’s C++ compilers.
Installation
$ gem install ruby-serialport
Any files and older versions can be found at rubyforge.org/projects/ruby-serialport/
Examples
reuire 'rubygems'
require 'serialport'
sp = SerialPort.new "/dev/my-modem", 9600
sp.write "AT\r\n"
puts sp.read # hopefully "OK" ;-)
A functional example can be found in examples/miniterm.rb
– Ruby’s copy of miniterm.c
For a compeate API reference see the RDoc of SerialPort.
License and Copyright
Copyright (C) 2008 Jonas B