# Millis Timing Loop

**URL:** <https://forum.arduino.cc/t/millis-timing-loop/1008619>\
**Category:** Programming\
**Created:** [July 2, 2022, 6:18am UTC](https://forum.arduino.cc/t/millis-timing-loop/1008619 "2022-07-02T06:18:10Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [July 2, 2022, 7:45am UTC](https://forum.arduino.cc/t/millis-timing-loop/1008619/4 "2022-07-02T07:45:03Z")

</div>

Hi @Farticus

> [@Farticus](#):
>
> I am trying to set up a timing loop for an integer input.

You should describe in normal words what this means

> [@Farticus](#):
>
> I can get the millis to function as a stand alone sketch

These words do not contain any filename of an "official" example-code so it is unclear **which** sketch you mean. Post this sketch where you

> [@Farticus](#):
>
> can get the millis to function as a stand alone

From looking at your code I **assume** :

your code shall wait until you send a character from serial monitor to your arduino  
If character is received start "waiting" for 5 seconds  
If 5 seconds are over print "Finished"

If "waiting" is over print "After Timing Loop"

I'm **un** sure if this is what you are trying to do.

Anyway you are another victim of this still to this day ignored very bad introduction to programming provided by the Arduino-Team:

These are really harsh words - I know. It is a very concious decision to write them. And I want to explain why:

- 1.) A lot of of the basic introductional examples installed with the arduino-IDE use the function delay().

- 2.) an **easy** to understand introduction to non-blocking programming is **missing**

The combination of these two things put newcomers

## on the wrong track

It teaches the newcomers to think in a linear = **non** -looping way.

additionally this famous infamous blink without delay-example shows an

## unnescessary complicated way

of how non-blocking timing can be coded.

In summary I call this

## "the experts blindness for beginner-difficulties"

An easy to understand example starts with a **very common everyday example analogon**

and describes the principial function **based on this analogon**.

Here is my attempt to do it this way  
and of course as me myself are to some extent an "expert" myself,  
me myself suffer from experts blindness for beginner-difficulties too. This can be resolved through a lot of beginners questions that guide "the expert" what is still difficult to understand and to improve the explanations.

> [@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):
>
> 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/millis-timing-loop/1008619)._
