Trouble with attachInterrupt when using break beam sensor for rotary encoder

Hi. You fell into the common trap of attachInterrupt(). The syntax is as follows:

attachInterrupt(digitalPinToInterrupt(pin), ISR, mode); (recommended)
attachInterrupt(interrupt, ISR, mode); (not recommended)

You used the second version where the first argument is the interrupt number. But you actually put the pin number in there (pin 2). Pin 2 is actually interrupt 0. Thats why they recommend you to use the first method. In your case, it should look like:

attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE);

Hope that helps.