Pages: 1 [2]   Go Down
Author Topic: Run multiple 'functions' simultaneously in loop  (Read 1335 times)
0 Members and 1 Guest are viewing this topic.
Manchester (England England)
Online Online
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

California
Online Online
Faraday Member
**
Karma: 92
Posts: 3447
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Melbourne, Australia
Online Online
Brattain Member
*****
Karma: 511
Posts: 19310
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

http://www.gammon.com.au/electronics

Please post technical questions on the forum - not to me by personal message. Thanks a lot.

Pages: 1 [2]   Go Up
Jump to: