Keep an attachInterrupt for determinate time

It is (arguably) better in most cases to use a boolean variable to create a software "mask" for the interrupt handler, that tells it whether to process or ignore the interrupt, rather than constantly attaching and detaching the interrupt handler.

Regards,
Ray L.