Start a new topic

Could Nextion "Click" can trigger arduino function

Hi guys

I made an HMI

when I press start ,it can turn LED on and count down

and I wrote click function in timer(tm0) 

if count down over timer will "click" off button

the question is Nextion could see "off button" is activate

but it can't send signal to arduino tx

so LED couldn't OFF

Does somebody knows how to use click function to trigger arduino function

thanks in advance 


sorry for my bad English

(1.35 KB)

P.s my nextion is 7"

so hmi file should notice this 

To trigger functions on Arduino or whatever MCU, there are basically two ways:

1. You add code to your HMI to send something via serial to the MCU. Then you write code for the MCU to parse the incoming serial data stream and to launch the desired function if the data sequence matches.

2. You use an extended Nextion with GPIO and add code to your HMI do drive one GPIO pin hi or lo. Connect the Nextion GPIO pin with a GPIO pin of the MCU (and both GND, too) and write a pin interrupt handler for the MCU.

Both variants are elementary tasks which each developer should master.

1 person likes this

Thanks Thierry Frenkel,

do you have some example about hmi drive gpio hi or low

hope you can share some example let me study


I think Thierry stated this is elementary.

Hard to build an example of variable equals 1 or 0

Thanks Patrick Martin,

thanks your reply,

had u seen my file at top i have done some function

but how "click" function to trigger arduino is really confused me 

or maybe click is not a good choice please let me know

thank you guys

Click triggers event code

 - for this click command to trigger Arduino has two choices

    a) over RX/TX to Serial

         - Nextion is instructed to send a sequence

         - Arduino is instructed to listen for sequence

     b) over GPIO to Digital

         - Nextion is instructed to set HI/LO on pin

         - Arduino is instructed to react to HI/LO on pin

In either manner, once your condition is received

  - call your Arduino function you wanted


So this is pretty much what Thierry stated, a bit more visual

Thanks Patrick Martin

I know what you want to teach me 

but I research so much , there's no topic said how to send a sequence from nextion to arduino

even though I am a noob in program

I just copied some example and change some component 

if I want to know more do you have tutorial or something like that 

thanks in advance 

and have a nice day


sorry Max, are you seriouse?


(237 KB)
I fear that he is serious... Unfortunately, people often don’t understand that forums like these are only to deal with specific questions, in this case the Nextion HMI. This is, IMNSHFO, not a primary school where people can learn elementary coding tasks. I expect that people are familiar with writing code for their selected MCU, especially about Serial communication, before they start asking questions here. As it is highly illegal in my country to let people who haven’t a driving license drive your car, such posts with basic or low level questions showing clearly that there is no “MCU driving license” should simply be deleted as these are a waste of storage and bandwidth. There is already an excellent tutorial which explains everything about the communication between MCU (Arduino) and the Nextion HMI, and that is the famous Nextion library. Studying its code will teach people almost everything they need to know.
Login or Signup to post a comment