Rob wrote:
I have a programming/operational question as follows; My machine has a vacuum arm which contacts an empty bag and picks it up. The vacuum arm has a spring-loaded micro switch on it (normally open) which, when it contacts the bag, closes (an input). This causes the vacuum arm to reverse and now the spring loaded micro switch is, physically (open), OFF.From a programming view, do I still need to tell the controller that the switch is OFF (open) in order for it to be used again (eg. waiton) as an input to do a different function??
This may sound like a stupid question but it is to clear up what is physically going on versus what the controller believes is the state of an input.
More often than not it is safer to write the program to track both states of a switch. For example, this will give a push on/push off light switch:
Loop WaitOn Switch
On Lamp
WaitOff Switch ;<<<<<<<<
WaitOn Switch
Off Lamp
WaitOff Switch ;<<<<<<<
GoTo Loop
The program will not work without the highlighted instructions.
A program to flash the light for 1 second whenever the switch is pressed could be deceptive.
Loop WaitOn Switch
On Lamp
Pause 100
Off Lamp
WaitOff Switch ;<<<<<<<
GoTo Loop
Without the highlighted instruction this will work if the user presses the button (switch) briefly. If the user holds the button down, however, it will fail to work correctly. In the extreme this kind of programming oversight could result in amputated fingers!
You could also look at WaitOnK or GoIfInK.
