2

Is it possible to use something like:

require 'serialport.o'

with Shoes? serialport.o is compiled c code as a ruby extension.

When I attempt to run the following code in shoes, I see no visible output to the screen and shoes crashes on OS X.

Thank you

CODE:

require "serialport.o"

port = "/dev/tty.usbserial-A1001O0o"

sp = SerialPort.new( port, 9600, 8, 1, SerialPort::NONE)

Shoes.app :width => 300, :height => 150, :margin => 10 do
  button "On" do
  sp.write( "1" )
  end
end

sp.close
JeffV
  • 52,985
  • 32
  • 103
  • 124
  • As a side note, it's generally better to just say `require "serialport"`. Ruby will figure out the extension for you. That makes your code a little more flexible. – Peeja Dec 21 '08 at 18:56

2 Answers2

1

You've probably already checked this, but does the same thing work if you aren't using Shoes? For example:

require "serialport.o"

port = "/dev/tty.usbserial-A1001O0o"
sp = SerialPort.new( port, 9600, 8, 1, SerialPort::NONE)
sp.write( "1" )
sp.close
Moss Collum
  • 3,542
  • 3
  • 25
  • 23
0

I had a similar problem, but it's with winxp.

Could you try like this?

Kernel::require "serialport.o"
DorianG
  • 21
  • 1
  • 2