Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delay when reading sensors can affect timing sensitive code #5

Open
BootsSiR opened this issue Dec 17, 2022 · 0 comments
Open

delay when reading sensors can affect timing sensitive code #5

BootsSiR opened this issue Dec 17, 2022 · 0 comments

Comments

@BootsSiR
Copy link

I use this code on an LED controller board I created. I noticed I was seeing data corruption on the LED data line due to some timing issues. I managed to track it down to this code. The delay's can cause problems with timing sensitive code (ie: WLED). I may try to rewrite it without the delays but I may not have the time for a bit.

// Request sample
  digitalWrite(pin, LOW); // Send start signal
  pinMode(pin, OUTPUT);
  if ( model == DHT11 ) {
    delay(18);
  }
  else {
    // This will fail for a DHT11 - that's how we can detect such a device
    delayMicroseconds(800);
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant