Arduino interrupts on an of switch


I have a shuttle train problem.
To make sure the train runs smoothly back and forth, I use two reed relays at the place where the train should slow down.
Train stops right on time, only to leave a little later in the opposite direction.
But then it meets the reed relay again on which it slowed down.

So then it immediately slows down again, that is not the intention, it should only slow down when it passes the reed relay on the other side.
For this I have to, while accelerating at the start, temporarily disable the interrupt, to switch it back on a little later, during the ride, before it meets the other reed relay to slow down again.

With sei(); and cli(); enable and disable the interrupts
But also with interrupts(); and nointerrupts(); switch on and off.
Once I have disabled the interrupts, the subroutines no longer work either

thanks in advance
greetings Dré

@drejansen Welcome to the RobotShop Community. A bit late, but were you able to resolve the issue? Not easy to help with just a snippet and a general idea of what you’d like (which it likely why nobody has answered so far).