golden2620,
I suggest you use a independent source for the source. You are using interrupts to generate the source and to read it; this can fail when other higher priority interrupts happen. Also writing to Serial inside an interrupt is not recommended, it is much better to save the values to a buffer and print them in the loop() when it's full.
I suggest you use a independent source for the source. You are using interrupts to generate the source and to read it; this can fail when other higher priority interrupts happen. Also writing to Serial inside an interrupt is not recommended, it is much better to save the values to a buffer and print them in the loop() when it's full.