Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #3102
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!talisker.lacave.net!lacave.net!not-for-mail |
|---|---|
| From | Regis d'Aubarede <regis.aubarede@gmail.com> |
| Newsgroups | comp.lang.ruby |
| Subject | Re: Let Ruby read the serial port |
| Date | Mon, 18 Apr 2011 09:26:39 -0500 |
| Organization | Service de news de lacave.net |
| Lines | 37 |
| Message-ID | <7f7e324059eb3bbe4eb5e07ceac63ea2@ruby-forum.com> (permalink) |
| References | <1c3018ffaf2482d637183ffea57c2d54@ruby-forum.com> |
| NNTP-Posting-Host | bristol.highgroove.com |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | talisker.lacave.net 1303136818 68380 65.111.164.187 (18 Apr 2011 14:26:58 GMT) |
| X-Complaints-To | abuse@lacave.net |
| NNTP-Posting-Date | Mon, 18 Apr 2011 14:26:58 +0000 (UTC) |
| In-Reply-To | <1c3018ffaf2482d637183ffea57c2d54@ruby-forum.com> |
| X-Received-From | This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway |
| X-Mail-Count | 381780 |
| X-Ml-Name | ruby-talk |
| X-Rubymirror | Yes |
| X-Ruby-Talk | <7f7e324059eb3bbe4eb5e07ceac63ea2@ruby-forum.com> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.ruby:3102 |
Show key headers only | View raw
I use IronRuby :
require "mscorlib"
require "System.Windows.Forms"
def portConfigure(portName,bauds,bits,stop,parity)
@components = System::ComponentModel::Container.new()
@serialPort1 = System::IO::Ports::SerialPort.new(@components)
portName ||= "COM3"
bauds ||= "9600"
bits ||= "8"
stopBits ||= "1"
parity ||= "none"
#puts "Configure..."
@serialPort1.DtrEnable = true
@serialPort1.RtsEnable = true
@serialPort1.PortName = portName
@serialPort1.StopBits = stopBits.to_i
@serialPort1.BaudRate = bauds.to_i
@serialPort1.DataBits = bits.to_i
@serialPort1.Open()
@serialPort1.DataReceived do |sender, e|
buff = @serialPort1.ReadExisting()
scanner(buff)
end
end
def writeString(str)
buf = System::Text::Encoding.GetEncoding("ASCII").GetBytes(str)
size = buf.Length
@serialPort1.Write(buf, 0, size)
end
--
Posted via http://www.ruby-forum.com/.
Back to comp.lang.ruby | Previous | Next — Previous in thread | Find similar | Unroll thread
Let Ruby read the serial port "Superpelican X." <superpelican12@gmail.com> - 2011-04-16 07:58 -0500
Re: Let Ruby read the serial port Brian Candler <b.candler@pobox.com> - 2011-04-16 16:14 -0500
Re: Let Ruby read the serial port andrew mcelroy <sophrinix@gmail.com> - 2011-04-16 16:38 -0500
Re: Let Ruby read the serial port Josh Cheek <josh.cheek@gmail.com> - 2011-04-16 17:03 -0500
Re: Let Ruby read the serial port Regis d'Aubarede <regis.aubarede@gmail.com> - 2011-04-18 09:26 -0500
csiph-web