Oatmeal, "Just enough Iron in your Serial," is a Ruby library that
provides a minimal wrapper around the .NET System.IO.Ports API for
IronRuby. It mimics the read
, write
and readline
methods from its more
full-featured cousin, the serialport Ruby library.
- IronRuby.
- Mono or .NET.
igem install oatmeal
, or just put serialport.rb
somewhere
in your LOAD_PATH
.
Sample code:
require 'serialport' port = SerialPort.new '/dev/ttyUSB0', 9600, 8, 1, SerialPort::NONE port.read_timeout = 1000 begin port.write 'something' puts port.read ensure port.close end