Forum Controllers/PLC

Welcome!

This community is for professionals and enthusiasts of our products and services. Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

Millis vs Delay

Avatar
Guest

Hi, I have seen that depending on the program, there are times where it is used the millis function while in others the delay one is chosen.  What is the difference between both, and which one is the best?

Maria

Avatar
Discard
1 Answer
0
Avatar
Marti Guillem Cura
Best Answer

Hi Maria,

The principal difference between the two functions is that the Delay() one is a blocking function. It means that if you call it, the program will be stopped until it the delay action has finished. So, it is usually better to use the millis() function as the call is very similar and it does not block the entire program.

For more information about the theme, we have an specific blog where we explain in more depth both functions, their differences and how can they be implemented. You can check it on the following link.

Thanks for asking, we hope to have been helpful.

Avatar
Discard