Nextion to trigger arduino to start a loop

How can I trigger the programmed loop in Arduino to start with a press of a button from Nextion.

I built the .UNO and HMI.

What can I do to trigger this function ( my options?)

I was thinking, have Arduino to listen on one of its analog pins and then start void loop ( since Arduino runs only one line at a time.

It is for a project I’m building Please Help!

makeup_brush_-02-_test.ino|attachment (1.81 KB)

    delay(180000);                // wait for a second

A REALLY long second.

How does the Arduino know that the Nextion even exists?

Thank You for a quick reply!

It doesn’t have to, I think…
All Arduino needs to know is, one of its pin just went high, and start the loop.

Here is the code, the pin can be any one of its pins.

It will be same as a button press. Am I missing something? please tell me NO

makeup_brush_-02-_test-button.ino|attachment (2.65 KB)

Here is the code

What does that code do?

It
would
be
a
lot
easier
to read that
code if it bore any resemblance
to properly indented.

Use Tools + Auto Format to do that.

buttonPin and buttonState are lousy names. The button (SWITCH!) serves some purpose. The variable names should reflect the purpose, not the kind of hardware attached.

I suspect that you want to pay attention to when the switch BECOMES pressed, not when the switch IS pressed. The state change detection example will show how to do that.

What IS connected to the buttonPin? How is it wired? Does it pull the pin up or down consistently?