Start a new topic

Nextion Touch Screen "Start" button to start arduino 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.

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

(71 KB)

You can not in this manner.

Aurduino runs setup(), and immediately loop()

For this there is no intervention.

Thank You for quick reply!

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.


Please look at the Iteadlib Arduino Nextion Library

You will want to download and install.

Please configure NexConfig.h for the UNO as directed in

Then take a look through the library examples

The way this works is the Nextion is initialized in the setup() with nexInit()

Arduino loop() runs immediately after setup

in each iteration of the loop

    - nexListen looks for your Nextion Touch Events

       - if one is found and you have set it up,

          then nexListen will call your procedure.

    - all other things you define in your loop() will be run

At the end of loop, loop() starts all over again.


CompButton example will show you how to trigger code from a button

Study the library code, study the examples.

Thank You Sir, I have some HomeWork to do
Thank You!


I put a start and stop button on my Nextion display.  When my arduino fires up I have the setup() set a flag "ControllerRunning = false;".   my loop() functions has everything wrapped in an if statement like this....

If ControllerRunning {
   do stuff }

The buttons do nothing more than start or stop the controller.  My controller manages 2 temperatures (air , meat).  The controller reads the recipe from a micro sd card and allows you to alter it.   It manages the recipe and turns a gas solenoid valve off and on through a relay.  


Login or Signup to post a comment