- How can i switch relay with heating load on at 30 seconds, then switch em off, and do it with anoter pairs - DHT11-relay?
Look at the blink with delay example, and get rid of that delay.
Think about how YOU would switch the relay on and off if the on time were 30 days, instead of 30 seconds. You could stand next to the relay, with your finger poised over the switch, waiting for the 30 days to elapse. No sleeping, no bathroom breaks, no meal breaks.
On the other hand, you could write down when the relay was turned on, and how long it is supposed to be on for. Periodically, you'd check to see if it was time to turn it off. If so, you'd do so. If not, you'd just walk away.
Periodically, on the Arduino, means every pass through loop(). Writing down when means using a variable to store a value. Checking the time is a matter of calling millis().
- How can i switch number of relays in one tact like: "Measure for DHT11 #1, DHT11 #2, DHT11 #3, DHT11 #4, then switch Relays # 1,3,4 On and wait 30 sec< then OFF for all"?
I'm not sure that I understand the question. Are the relays linked to the temperature sensors? That is, if temperature sensor 2 reads high, do you activate relay 2?
If so, then the sensor and relay actions are not linked to other sensor and relay actions. Read sensor n. Make a decision regarding it's value. Implement the decision. Record when the decision involved turning the relay on.
Separately, check the on time(s) (for the relay(s) that are on (on time is not 0)) against the current time, to see if it is time to turn the relays off (and clear the on time).