Elfoc
Elfoc

Reputation: 3689

LPT ports in C#

I'd like to send some instructions while one of pins of LPT port is on.

I was trying to do something like this:

When LPT port 379 (889 dec) is different from dec 120 then stop doing part of code.

while ((PortAccess.Output(889,120))

I don't know how to do it. I was trying to do something with construction:

while ((PortAccess.Equals())

but you need to compare 2 objects..

I suppose it must be very simple solution for this problem.. :)

Upvotes: 2

Views: 1347

Answers (1)

Emile
Emile

Reputation: 2230

I think you will need PortAccess.Input:

while (PortAccess.Input(889) == 120)
{
   // do stuff
}

This assumes that "PortAccess" is a wrapper around the native inpout32.dll such as described in this tutorial.

Upvotes: 3

Related Questions