P
P
Pavel2020-10-03 10:55:17
Arduino
Pavel, 2020-10-03 10:55:17

How to make 2 unrelated timers?

there are 2 relays, they should work independently, for example, there is button 1 and button 2, press button 1 and relay 1 closes for 10 seconds, if you press button 2 at this time, then relay 2 closes for 5 minutes,

the problem is that while 10 seconds 5 minutes will not pass, but if instead of 10 seconds there will be a long time? ..
how to get out of the situation?

how to force delay(5000); work in parallel?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir, 2020-10-03
@mrusklon

No need to force.
It is necessary to refuse delay(), absolutely.
And there will already be something for the soul, you can use the timer, or millis ()
As an example, see the topic "blinking the LED without delay".

L
lonelymyp, 2020-10-03
@lonelymyp

The best thing to do with delay() is never to use it again.

A
Alexander Skusnov, 2020-10-03
@AlexSku

I advise you to start learning automation. Because on a PLC (Programmable Logic Controllers) the program consists of two single vibrators
5f785130b2f6c516628233.png
How do I go to Arduino?
1) practice programming in Codesys text and graphic languages
​​2) you can take other languages ​​for Arduino
3) you can develop an algorithm in Stateflow (MatLab and Simulink state graph language) and translate it into Arduino.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question