Interrupting a WHILE or FOR loop

Using a WHILE loop will suspend any other processing by the Nextion, unless you have DOEVENTS added into the loop. That only refreshes the screen.

I have a countdown timer onscreen and want to be able to issue a STOP command from a screen press, but the Nextion doesn’t recognize it.

How could I make that work?

Can’t you just disable the timer as follows:
which should stop the countdown time

I don’t believe it’s possible to interrupt a loop with a touch event. I ‘want’ to be able to touch a ‘STOP’ button on the HMI to stop the countdown timer which is displaying on screen.

Not sure if this helps but google ‘nextion while’ and look at youtube video ‘148 nextion’

That video explains the loops, but not much help for what I need. I then discovered the ‘timer’ object and I think that will work perfectly!

In your WHILE/FOR loop, check the tch0 and tch1 values. These indicate the current touch positions (x,y coords). If they indicate a valid touch location then “STOP”

Didn’t know about those, I’ll check it out. Thanks!!