Ruby serialport

  • Thread starter Stanislav Kolotinskiy
  • Start date


Stanislav Kolotinskiy

Hi all!

I am trying to find out, how should I work with the serialport
library. I have a 3G modem, ZTE MF637. I have a snippet of code to
test the library:

require 'rubygems'
require 'serialport'

sp ='/dev/ttyUSB2',9600)
sp.read_timeout = 2000

I am trying it in two ways: as commands in irb and just as a script.
All commands go fine, but when I input "", the output is empty:

[email protected]:/tmp/ruby-serialport$ irb
ruby-1.8.7-p302 > require 'rubygems'
=> true
ruby-1.8.7-p302 > require 'serialport'
=> true
ruby-1.8.7-p302 > sp ='/dev/ttyUSB0',9600)
=> #<SerialPort:0xb76f39e0>
ruby-1.8.7-p302 > sp.read_timeout = 200
=> 200
ruby-1.8.7-p302 > sp.write("AT\r\n")
=> 4
ruby-1.8.7-p302 >
=> ""

The modem is fine, I tried to connect to Internet over it, and it
works. I even read the logs of pppd, and I saw that init strings pass
fine. What can I do?

Thanks a lot.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question