Go Down

Topic: Run multiple 'functions' simultaneously in loop (Read 1 time) previous topic - next topic

Grumpy_Mike


blink without delay would result in nothing, since it's looped thru in rapid speed.!?

No you do not understand it.
The blink without delay makes a note of the time now and when something needs to be done. Then the loop goes very fast seeing if it is time to do the task. If it is you do the task and set the time to do it again. It mattes not if the task is blinking an LED or stepping a motor.
If you do this with two tasks you have your two stepping motors running at the same time at speeds set interdependently.

Arrch


So the led would then be lit !? Since it doesent know when to take next action?

Sorry not sitting with arduino now. Did som tests earlier today and thought i got it. Right now im trying to understand the theory of if. Thanks for all input!


You really should be playing around with the blink without delay example. Changing things and see how it affects the behavior. Only when you fully understand the concept, can you apply it to what you are trying to do.

Nick Gammon


blink without delay would result in nothing, since it's looped thru in rapid speed.!?


Look, if you are boiling an egg and frying some bacon "at the same time" that doesn't "result in nothing" because you are "looping through in rapid speed" does it?

You put the egg on. That's one thing. You put the bacon on. That's another thing. They are now cooking together. They only thing you do "rapidly" is check your watch to see if they are done.
http://www.gammon.com.au/electronics

Go Up