"It doesn't seem to work" conveys no useful information to enable us to help. The code does something. What does the code do? How is that different than what you want.
Interrupt service routines (ISR) should be kept a short as possible. One cannot use functions that depend on interrupts in an ISR (Serial.print for instance).