understanding attachinterrupt in a pulse counter

The code inside the

if (millis() - lastRead >= interval)

only runs once every 100 millisecs.

During that interval every time an ISR is triggered the value in the variable count is incremented.

At the end of the interval the accumulated value is copied into the variable copyCount and the value of count s set back to zero ready to be incremented again during the next interval.

So what gets printed by the line

Serial.println(copyCount);

is the number of counts in the most recent 100 millisecs.

Does that help?

...R