Inserting IR sensor code into existing project

using a single detector, you could indicate stop and once clear of the detector, indicates approach on a timer and clear when the timer expires.

some other mechanism, possibly a manual switch would be needed for approach-diverging