Wowwee MIP V2 icon Wowwee MIP V2 — UART interface to hack WowWee MIP with ESP32/ESP32‑Cam or EZ‑B v4 for ARC; hardware UART preferred, configurable power and baud 9600/115200 Try it →
Canada
YouTube
Asked — Edited
Resolved Resolved by DJ Sures!
1 Participant

How Can Two Commands Be Run At The Same Time?

I am trying to get two commands to run at the same time ( without success ). For example:


Left(1,2000)
ControlCommand("Auto Position", AutoPositionFrame, "Stretch Left", 10,1,1)

The program runs the first line, once that is completed then the next line runs. Is there a way to have them run simultaneously?


ARC Pro

Upgrade to ARC Pro

Join the ARC Pro community and gain access to a wealth of resources and support, ensuring your robot's success.

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#1  

First, we'll change your question to "how to run two commands consecutively without delay". This is because a computer runs instructions one at a time. A program is a list of instructions. Each instruction is read and then run. That's how computers work. What you don't see is the small lag between commands/instructions, which gives the appearance of "things happening at the same time".

So let's now look at your code...

The first command is specified Left to run for 2,000 ms (which is two seconds). You're asking the command to run for two seconds. This means you can't expect the next command to execute until the first command has completed, which will take 2 seconds.

Perhaps what you can do is this...


left(1)
ControlCommand("Auto Position", AutoPositionFrame, "Stretch Left", 10,1,1)
Sleep(2000)
Stop()

#2  

Thanks DJ. That added some clarity, it's the order of the commands as well. This is giving me what I am looking for;


ControlCommand("Auto Position", AutoPositionFrame, "Stretch Left",10,1,1)
left()
Sleep(3000)
Stop()