I am making a four legged walker with 12 micro servos and some 3D printed parts.
Its really just going to walk and move, I dont plan on adding sensors but maybe in the
future.
I have been playing around with a sketch and am able to move the legs around and slow
them down and such. The more I read about the arduino programming language, the more
it looks like I should be using Millis instead of delay but that looks like a whole different and
much more complicated way of moving servos and I have not found how to move them
opposite of each other or how to slow or speed them up using Millis.
Should I stick with Delay for now or go ahead with Millis.
Thanks.
Absolutely, the sooner the better.
millis() isn’t limited to freeing up sensors, but can allow dynamic changes in gait, several concurrent moves can occur at the same time (needed for balance etc)
It is not that difficult but it requires a different way of thinking.
And as a consequence restructuring of your current program.
Have a look at blink without delay and state machine examples. See if you can understand those and build from there.
Don't be afraid. Try.
red_car
February 19, 2023, 7:50am
4
I would be inclined to use millis() from the start if you can. As your program gets more complicated it will get harder to change.
It's not that difficult, and once you understand the basic technique it makes your code much more flexible.
Check out the classic example sketch BlinkWithoutDelay.
There are also lots of tutorials that attempt to explain the basic principle... like this one.
https://www.gammon.com.au/blink
If you post your code we may be able to provide advice on ways that you could change it.
1 Like
Thank you for the replies. This morning I started playing around with millis.
This Blink without delay example makes non-blocking timing harder to understand than it must be.
The reasons are:
no everyday analogon at all
not enough commenting
no "encapsulation" of the function but instead spreading the used variables
This tutorial uses an everyday example of baking a frosted pizza to explain the basic principle
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 princip…
especially for servos there are multiple libraries that make it easy to slow down servo-movements.
best regards Stefan
cherk
February 19, 2023, 11:58pm
7
Also check out @Koepels " Fun With Millis"
system
Closed
August 18, 2023, 11:59pm
8
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.