Posts

Showing posts from May, 2023

Arduino millis() vs delay() - what is the difference?

Arduino millis() vs delay() Arduino is a hardware & software based platform, which gives a great opportunity to the hobbyist, students to learn and create interesting projects. However, by being expert with Arduino you can make advance projects as well.   In this article I am going to discuss about delay and millis() functions. When we can use these functions to generate delay.   What is the millis() & delay() function in Arduino? This function gives the time value in milliseconds since board was started. Advantage of using this function is program does not stop during delay. Other task continue to take place. While if you use ‘delay’ function, then program is paused for the time set in delay function. For example. If I use delay (5000) Then program will be paused for 5000 milliseconds or 5 seconds. To save the value of millis(), you should use variables of ‘unsigned long’ type because the value is in milliseconds and it increases very fast. For ex