I have a For...Next loop and within the loop I need it to wait for the value of a variable to be under 10, before executing the next line. The value of this global variable is controlled by other functions. Here is how I do it currently.
This code doesn't always work correctly. Also today I read in another thread that DoEvents can kill battery. It was mentioned that you could achieve a DoEvents effect with Timer. My question is how can I use Timer in the above routine, instead of DoEvents, to improve the code overall?
B4X:
For i=0 to 10
.
.
.
.
Do While c>10
DoEvents
Loop
.
.
.
Next
This code doesn't always work correctly. Also today I read in another thread that DoEvents can kill battery. It was mentioned that you could achieve a DoEvents effect with Timer. My question is how can I use Timer in the above routine, instead of DoEvents, to improve the code overall?