Create a small project showing the problem and upload it. Hard to help with the informations you provide. No one can answer here if we do not know what you are doing.
Create a small project showing the problem and upload it. Hard to help with the informations you provide. No one can answer here if we do not know what you are doing.
If there are any async calls in your recursive sub you may need to wait for every one or you are going to get unexpected results.
I don't think you want the sleep in the recursion. Then it will simply move on to one of the other recursions. Create another sub, call your recursive, slow sub from that with wait for. That will return your program to main thread and leave the slow function to continue.