How to use millis() for different servos

Hello guys,

I want to do something with servos. I heard the delay command can cause some problems so I wanted to work with millis().
The Problem is, I don't really understand it.
For example, i got 2 different servos, how can i manage it, that one of those moves for 90 degree then after 1 second the other moves for 90 degree and then after another second the first moves back to 0, a second later the second goes back too.
I know that you can count the milliseconds with millis() but how can you say that it should do it when for example 2000 milliseconds are reached?

English is not my native language so i apologize for writing mistakes :slight_smile:

Greetings and thank you for the answers

The demo Several Things at a Time illustrates the use of millis() to manage timing. It may help with understanding the technique.

Using millis() is much the same as using your kitchen wall clock to time the cooking of a chicken. Using delay() is the equivalent of sitting watching the oven for 90 minutes - which you would not dream of doing. Instead you note the time when the chicken goes in the oven and periodically check the clock to see if the 90 minutes has elapsed.


"equivalent of sitting watching the oven for 90 minutes "
Scalloped potatoes and Red Lobster Biscuits? 8)