Hi I am new to Arduino. I was wondering if I could run multiple loops at once. I know that you can't just put
void loop(){
//code here
}
void loop(){
//code here
}
I was just wondering if there was any other way.
Hi I am new to Arduino. I was wondering if I could run multiple loops at once. I know that you can't just put
void loop(){
//code here
}
void loop(){
//code here
}
I was just wondering if there was any other way.
Do not cross-post. Other thread removed.
You have to code one loop to do both things.
You can get true multitasking, if you hook multiple arduinos together to communicate, say with software serial. I do this a lot with Nanos, since they're under $3 apiece.
OK guys I don't need anymore answers. I did some searching around and figured out that there is a way to have multiple loops. Your loop would look like this:
void loop(){
loopPart1();
loopPart2();
loopPart3();
}
That's not "multiple loops". That's one loop function calling several other functions that just happen to have loop in their names.
Delta_G:
That's not "multiple loops". That's one loop function calling several other functions that just happen to have loop in their names.
Perhaps - but that is the correct way to create the illusion of multiple loops when there is only one MCU.
@CKR123, have a look at the demo Several Things at a Time
...R
It might be a little advanced for the OP, but I usually make classes with a setup() and loop() method, and write the code in such a way that it kinda-sorta works asynchronously.
Mypage at Arduino the Object Way.
jrdoner:
You can get true multitasking, if you hook multiple arduinos together to communicate, say with software serial. I do this a lot with Nanos, since they're under $3 apiece.
I used that to it works great
but if CKR123 can manage his code by using
void loop(){
loopPart1();
loopPart2();
loopPart3();
}
it is cheaper and i think easier to..
Thanks @PaulMurrayCbr I will take a look at the page u posted it looks interesting for me
@ PaulMurrayCbr:
I just have to say thanks for the link to your site amazing man... How simple your void loop and void setup is after its all said and done