It is difficult to understand your explanation, but it may be that you want to detect when a train becomes detected rather than when a train is detected.
If you can give a better explanation then it will be easier to provide help.
It is difficult to understand your explanation, but it may be that you want to detect when a train becomes detected rather than when a train is detected.
If you can give a better explanation then it will be easier to provide help.