digitalReadFast sometimes takes ~1 sec to complete on Teensy 4.1

jmseight

Member
Hi,

The following command - lights the LED if pin 11 is HIGH -

digitalWriteFast(13, digitalReadFast(11));

works well most of the time, but once in a while will hang for ~1 sec.

digitalWriteFast(13, digitalRead(11));

does not have the same problem.

Thanks,
James
 
In the absence of complete source code its hard to say anything, but my guess is you have an ISR taking far too long to complete and
this isn't to do with digitalReadXXX, which just read hardware registers.
 
You can eliminate the effect of interrupts by surrounding the code with cli() and sei().
 
Back
Top