In VB it only receives keystrokes from the IPac into a text field and
reacts to the keystrokes as they come in. Not real code but you'll
get the idea -
If (Keystroke == F)
Then score = score + 200;
end if
So there really isn't a state change here. Just reacting to
individual keystrokes. They way I worked around the need for state
change on certain switches is by turning them on or off to trigger a
new keystroke if the ball is sitting on the switch (in a lock or in
the trough). So at some point if one needs to check the balls and
where they are sitting I turn on the switch.
The electrical for this is by having an interface device turn on a
Mosfet to then allow the switch current through to the ipac. I use
this UHID -
http://www.ultimarc.com/pacdrive.html
The code then is a function that can get called when needed (again not
real code, but an example)
Function (Check Lock)
Packdrive port1 = True ;(This will open the switch circut through the
Fet)
(Once switch circut is opened the keystroke will register)
If (Keystroke == L)
Then lock1 = True;
end if
Packdrive port1 = False;
Packdrive port2 = True; (This will open the second switch circut
through the Fet)
If (Keystroke == M)
Then lock2 = True;
end if
Packdrive port2 = False
End Function (Check Lock)
So there isn't specifically ongoing state change checking, just a call
for the state when needed. Make sense? Secondarily, a timer is put
on the keystrokes that isn't here. You have to have it time out to
receive a false state. I didn't include that code. It can be a very
short timer. Either it is yes or no.