This will be a problem:
while (resultNumber < MAX_RESULTS) { }
resultNumber is modified by the ISR. However, it is multi-byte and access to it will be non-atomic in the non-ISR loop() code.
This will be a problem:
while (resultNumber < MAX_RESULTS) { }
resultNumber is modified by the ISR. However, it is multi-byte and access to it will be non-atomic in the non-ISR loop() code.