I currently have two WHILE loops in the main code listening to the port in case particular events that happen in the components. However, one of the loops is never reached since the 1st while loop loops indefinitely. I could achieve what I want by combining both WHILE loops into a single WHILE loop, but for business logic reasons that are too long and off the subject, I am not able to.
Therefore is there anyway to run 2 WHILE loops at the same time? Is there a workaround?
If I could create a timer using code, then I could delay by a few milliseconds starting one of the WHILE loops and theoretically I could get both running at the same time. But as far as I know creating a timer cannot be done programatically; it has to be done using XML which the main code doesn't have access to.
How do I get 2 WHILE loops running at the same time from within the main part of the code?