5
Answers

parallel port event handler?

wsdfg

wsdfg

14y
6.1k
1
I was able to salvage an ldr sensor from somewhere and now I'm playing around with it. was able to attach it to the parallel port along with an led so I can practice both input and ouput.

I was able to build a small program where if the ldr gets tripped the led will turn on

private void button1_Click(object sender, EventArgs e)
{
do
{
x= PortAccess.Input(889);
if(x==127)
PortAccess.Output(888,1);
if(x==111)
PortAccess.Output(888,0);
}while(x!=127)
}

I had to end it when it gets tripped otherwise its going to be an infinite loop. Now, what if I wanted to have it running the entire time the form is open, without having to press a button, and while other stuff are going on. what should I do?
I thought maybe I can make an event listener and handler for it, but how? or do I even need one and there is a simpler solution? Any ideas? thanks in advance
Answers (5)