« [Windows Mobile] Windows Mobile用クロスコンパイラ、CeGCC再び | Main | [Windows Mobile] Sigmarion III / jornada720でMortScriptを動かす »

2007.03.03

[Zaurus] Rubyからシリアルポートをコントロール ruby-serialport

Rubyからシリアルポートをいじれると、ぜってーおもしれーと思い、ruby-serialport 0.6をコンパイルしてみました。ruby-termiosを最初にいじってみようとしましたが、わけ分かんな過ぎて諦めました。

FocVさんの配布しているRubyのパッケージ向けのディレクトリ構成です。パッケージにはruby.hがいっしょに入っていたので助かったです。

開発環境をgcc3.3ベースにしたので、使う場合はlibgcc_3.4.4をインストールする必要があると思います。

「ruby-serialport_0.6_arm.ipk.bin」をダウンロード

「libgcc_3.4.4-1_arm.ipk.bin」をダウンロード

一応ruby-termiosもパッケージ置いときます。

「ruby-termios_0.9.4_arm.ipk.bin」をダウンロード

とりあえずPHSから位置情報を取得するのはOKでした。CFGPS2からもOKです。
CFGPS2の方は、

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

と4800bpsでOKかと思います。
ちょっとテストしてみたうんこRubyスクリプト置いておきます。

「ruby-serialport01.html」をダウンロード

可能性は無限大ですね。手始めに測地系の簡易変換関数でも移植しようかな。

|

« [Windows Mobile] Windows Mobile用クロスコンパイラ、CeGCC再び | Main | [Windows Mobile] Sigmarion III / jornada720でMortScriptを動かす »

Comments

hi,
I am new in ruby and studing serialport programming.But I cann't find any help docs of serialport how to program using ruby.I also download ruby-serialport from rubyforge.com but there isn't any docs indicating how to do. I am going to develop a small program of medical device under windows.So I'll be very grateful if you can give me some advice.

ps:my email is tianqing_zhang@tom.com

Posted by: | 2008.04.03 at 06:41 PM

Hi tianqing_zhang,

Unfortunately, I haven't experience to use ruby-serialport on Windows.
You can see info which related on ruby-serialport on Win32 on following url:

http://juju.org/articles/2006/08/16/ruby-serialport-nxt-on-windows

According to the page, If you bulid a ruby-serialport with Cygwin, Serial port emulation are as below:

COM1 -> /dev/ttyS0
COM2 -> /dev/ttyS1
COM3 -> /dev/ttyS2
...

Then you can open COM1 as below:

sp = SerialPort.new("/dev/ttyS0", 19200, 8, 1, SerialPort::NONE)

I think usage is the same as other environment.

Other my "dirty" source code is here. (Don't count on my source.):

http://moyashi.air-nifty.com/hitori/files/ruby-serialport01.html
http://moyashi.air-nifty.com/hitori/files/rqposition.html

Other source codes are here. (via Koders):

http://www.koders.com/default.aspx?s=require+%27serialport%27&btn=&la=Ruby&li=*

P.S. I'm newbie in programming.

Posted by: moyashi | 2008.04.03 at 08:58 PM

Post a comment



(Not displayed with comment.)




TrackBack

TrackBack URL for this entry:
http://app.cocolog-nifty.com/t/trackback/13760/14111530

Listed below are links to weblogs that reference [Zaurus] Rubyからシリアルポートをコントロール ruby-serialport:

« [Windows Mobile] Windows Mobile用クロスコンパイラ、CeGCC再び | Main | [Windows Mobile] Sigmarion III / jornada720でMortScriptを動かす »