# Replace delay function with millisDelay

**URL:** <https://forum.arduino.cc/t/replace-delay-function-with-millisdelay/1303110>\
**Category:** Programming\
**Created:** [September 19, 2024, 10:06am UTC](https://forum.arduino.cc/t/replace-delay-function-with-millisdelay/1303110 "2024-09-19T10:06:41Z")\
**Posts on this page:** 1\
**Showing post:** 33

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [January 5, 2025, 6:02pm UTC](https://forum.arduino.cc/t/replace-delay-function-with-millisdelay/1303110/33 "2025-01-05T18:02:15Z")

</div>

> [@GoForSmoke](#):
>
> I call it Thinking In Circles but I could call it Writing In Circles but that's not entirely accurate

I call it sharing. delay() is greedy about monopolizing the processor and keeping it from doing anything else. If you instead write your code to share and take turns, it makes it easy for multiple bits of code to share the processor.

See [this simulation](https://wokwi.com/projects/410290411914332161) that combines several different demonstrations of doing sharing/non-blocking code per [Combining multiple non-blocking codes - #2 by DaveX](https://forum.arduino.cc/t/combining-multiple-non-blocking-codes/1305885/2) -- It works because the components are all written to share the processor with other components.

---

_[View the full topic](https://forum.arduino.cc/t/replace-delay-function-with-millisdelay/1303110)._
