Hi, I suspect I need an Interrupt routine, but currently well beyond my skills.
I have two DHT11 sensors (Inside / Outside temps) in the one Sketch and both are working fine.
I have added three push-buttons to set threshold temps. One toggles through, "Inside," "Outside" and the other two, "Up," and "Down" for values. All working well.
But - there is a "delay(2000);" required for the DHT11 and that means I have to hold a button down for two seconds for each push. Without the delay the DHT11 readings are garbage, but the buttons work fine.
How can I keep the "delay(2000);" for the DHT11 and still have instantaneous use of the push buttons?
OR - Just thinking about it some more, maybe a Timer that waits for say a minute before checking the DHT11. I don't need the temps updated more often than that.
p.s. Some example code would be a great help if it is an Interrupt or timer thing.
You don't need interrupts.
You need to read and play with the blink without delay sketch that came with your IDE.
there is a "delay(2000);" required for the DHT11
You shouldn't read the device more frequently than every couple of seconds, that's true, but that doesn't mean you should have the processor twiddling its digits for all that time. You could be doing something useful, like reading the switches.
uint32_t lastRead = 0;
...
void loop()
{
 if (millis() - lastRead >= 10000)  // every 10 secs
 {
  lastRead = millis();
  DHT.read();
 }
 if (digitalRead(BUTTON1) == HIGH)
 {
  // etc
How would I know to look at those examples for what I need?
You need to read and play with the blink without delay sketch that came with your IDE.
I was foolishly of the opinion that this was a "help" forum.
I prefer to think of this as a self help community.
Thanks, I assume you have never had to learn anything - ever?
I'm sure I would have learned a lot more, a lot quicker had I had the Web available when I was
doing my basic learning, but sadly it was a long, long way in the future.
@NonArduo, You ask for help, you were given sound advice, then you trash the people helping you.
That's not normally the way help is received.
Have a great day.