I develop applications where I need to capture the edge of a state change. For example, when a discrete point changes from low to high. Currently I use a variable, which I call LastState. I do a comparison between LastState and the current value, if they are different I update the LastState variable to the current state and perform the required reaction.
if ((InputPoint=1) and (LastState=0)) Then
Perform whatever reaction should happen at the on edge
elseif ((InputPoint=0) and (LastState=1)) Then
Perform whatever reaction should happen at the off edge
Is there an easier way?