# Interfacing the parallel port

**URL:** <https://www.ruby-forum.com/t/interfacing-the-parallel-port/144492>\
**Category:** Ruby\
**Created:** [July 30, 2008, 7:25am UTC](https://www.ruby-forum.com/t/interfacing-the-parallel-port/144492 "2008-07-30T07:25:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![darudude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@darudude](https://www.ruby-forum.com/u/darudude)\
**Post date:** [July 30, 2008, 7:25am UTC](https://www.ruby-forum.com/t/interfacing-the-parallel-port/144492/1 "2008-07-30T07:25:12Z")

</div>

I’m working on a project that requires the outputting of data via the  
parallel port. Basically I want to set certain lines high and low with  
ruby. However, I can’t seem to find any example where ruby is used to  
communicate with the parallel port. This project is for a windows  
machine. In the past I’ve successfully managed to communicate with the  
port using inpout32.dll and VB6. Inpout32.dll would come in handy again,  
but I don’t know how to add a dll file to a ruby script.

Any help would be appreciated! Thx!

---

<div class="post-metadata">

**Author:** ![darudude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@darudude](https://www.ruby-forum.com/u/darudude)\
**Post date:** [July 30, 2008, 11:30am UTC](https://www.ruby-forum.com/t/interfacing-the-parallel-port/144492/2 "2008-07-30T11:30:44Z")

</div>

Use class Win32API.  
So you should be able to control all interface lines through  
Win32-API-functions.

“Darius Gai” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) schrieb im Newsbeitrag  
news:removed\_email\_address@domain.invalid…

---

<div class="post-metadata">

**Author:** ![darudude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@darudude](https://www.ruby-forum.com/u/darudude)\
**Post date:** [July 30, 2008, 10:39am UTC](https://www.ruby-forum.com/t/interfacing-the-parallel-port/144492/3 "2008-07-30T10:39:14Z")

</div>

> Any help would be appreciated! Thx!

I’ve had success interfacing with the serial port using the  
win32serial library ([http://grub.ath.cx/win32serial/](http://grub.ath.cx/win32serial/)). It uses a small  
C program together with a ruby wrapper.

require ‘Win32Serial’  
@port = Win32Serial.new  
@port.open(“COM1”)  
@port.config(9600, 8, Win32Serial::NOPARITY,  
Win32Serial::ONESTOPBIT)  
@port.timeouts(0, 200, 0, 0, 0)  
@port.write(“test\r”)

Perhaps this would give you a basis to build a parallel port  
interface ?

Chris

---

<div class="post-metadata">

**Author:** ![darudude](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@darudude](https://www.ruby-forum.com/u/darudude)\
**Post date:** [October 12, 2008, 6:24am UTC](https://www.ruby-forum.com/t/interfacing-the-parallel-port/144492/4 "2008-10-12T06:24:31Z")

</div>

Darius Gai wrote:

> I’m working on a project that requires the outputting of data via the  
> parallel port. Basically I want to set certain lines high and low with  
> ruby. However, I can’t seem to find any example where ruby is used to  
> communicate with the parallel port. This project is for a windows  
> machine. In the past I’ve successfully managed to communicate with the  
> port using inpout32.dll and VB6. Inpout32.dll would come in handy again,  
> but I don’t know how to add a dll file to a ruby script.
> 
> Any help would be appreciated! Thx!

Hi Darius,

Check out this example:

[http://zanev.wordpress.com/2007/04/15/introducing-ruby-to-the-parallel-port/](http://zanev.wordpress.com/2007/04/15/introducing-ruby-to-the-parallel-port/)

Hope it helps!

Zane.
