Introduction

It just works, but you need to compile the source. This doc includes how to install ruby-serialport to MacOSX and provides a sample code. Note that this document is as of Aug. 2007.

Download the latest source code from Rubyforge

http://rubyforge.org/projects/ruby-serialport/

Install

$ tar xvzf ruby-serialport-0.6.tar.gz
$ cd ruby-serialport-0.6
$ ruby extconf.rb
$ make
$ sudo make install

Sample

#!/usr/bin/env ruby

require 'serialport.so'

port = SerialPort.new(ARGV[0], 9600, 8, 1, SerialPort::NONE)
port.flow_control = (SerialPort::HARD | SerialPort::SOFT)

port.puts "AT +RSCP?\r"

while res = port.gets
  if (res =~ /OK/)
      break
  end
end

port.close

Question?

Please feel free to mail me!

Valid XHTML 1.0 Strict Valid CSS!