You would be better served if you posted this topic in 'General Electronics' or 'Programming Questions' section of the forum, possibly more people will notice it there.
Also, please try to be as descriptive and clear as possible, spend a few extra minutes to do this and provide code in the code section brackets so it is displayed correctly. It is provided there for you as a button on the online editor.
You can also help yourself much more by making use of serial print statements to see what is happening with your code.
That way you will learn.
Note: it's Necessary to use interrupt
Is that a statement or a question?
Please explain why.