# Measure time that a condition is true to then trigger and action

**URL:** <https://forum.arduino.cc/t/measure-time-that-a-condition-is-true-to-then-trigger-and-action/1159366>\
**Category:** Programming\
**Created:** [August 18, 2023, 6:41am UTC](https://forum.arduino.cc/t/measure-time-that-a-condition-is-true-to-then-trigger-and-action/1159366 "2023-08-18T06:41:46Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [August 19, 2023, 7:46am UTC](https://forum.arduino.cc/t/measure-time-that-a-condition-is-true-to-then-trigger-and-action/1159366/6 "2023-08-19T07:46:54Z")

</div>

Hi @teqlove86

welcome to the arduino-forum.

> [@teqlove86](#):
>
> Sorry if that’s confusing. Imagine how confused I am haha…

Very normal reaction to be confused with these poor written and poorly explained examples given by the Arduino-IDE (and most tutorials) .

The code user gcjr has posted has **zero** explanations and **non** - **self** explaining names. ~~Very likely to be confusing for a newcomer.~~

To understand how to **apply** non-blocking timing based on millis().  
Read this tutorial. It explains the basic principle with an everyday example.

> [@Example-code for timing based on millis() easier to understand through the use of example-numbers / avoiding delay()](https://forum.arduino.cc/t/example-code-for-timing-based-on-millis-easier-to-understand-through-the-use-of-example-numbers-avoiding-delay/974017/1):
>
> non-blocking timing. Execute code only from time to time. There are a lot of different ways to learn programming. This thread wants to add another approach that is different to the yet existing ones. UPDATE 06.01.2023 if you are mainly interested in applying non-blocking timing you can do a quick read of this short tutorial / demonstration If you are intersted in understanding the details how it works go on reading here. I use an everyday analogon in this post to explain the basic principle …

best regards Stefan

---

_[View the full topic](https://forum.arduino.cc/t/measure-time-that-a-condition-is-true-to-then-trigger-and-action/1159366)._
