Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: digitalReadFast sometimes takes ~1 sec to complete on Teensy 4.1

  1. #1
    Junior Member
    Join Date
    Apr 2020
    Posts
    7

    digitalReadFast sometimes takes ~1 sec to complete on Teensy 4.1

    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

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,837
    That is very odd. Can you post sample code to show that?

  3. #3
    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.

  4. #4
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    422
    You can eliminate the effect of interrupts by surrounding the code with cli() and sei().

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •