Start a new topic

Nextion and Arduino

When are we going to get some real how to videos?

Like what do i put in the "user code" on touch release event to send even a number like "102" so then the Arduino can do something if it receives that command number.

I have not even found a real howto on even the example's that are only 1 min or so long even the button example file for the arduino does not have the nextion file with it????

6 people like this idea


Itead never claim the right to tell

    - Nextion Displays are the perfect solution for everybody
    - Nextion Displays are the perfect solution for anything

There are surely many projects out, where the Nextion Display is just the wrong choice.

There are surely people out, who are already overtaxed with Nextion HMI concepts.

There are surely people out, who don't have any clue how to do things they like to do.

But I am sorry, we have more than 20000 registered users, and you are just 0.005% of them.

I have no problem that you post your individual opinion, your individual experience.

But please, don't speak in terms of ALL, don't insist that your opinion is representative for ALL. Because you are not.

Your opinion is YOUR opinion, but surely NOT representative for ALL.

If your expectancy is not fulfilled, feel free and change to 4d systems and see if you became more happy with. We are ok with this. Honestly I have my doubts ...

Challenge was declined and removed.


Not sure you really wanted to post in such an old thread

Indeed Nextion Editor was less capable 2 years ago when this thread was opened.

But Nextion does indeed offer the most easy in GUI design.

 - Store Font resources Nextion side of the RX/TX pair

 - Store Picture resources Nexion side of the RX/TX pair

HMI is Human Machine Interfacing

 - Human user interaction (press button, slide slider) - Request

 - Machine updates display with current values - Status

In this manner,

  - especially when compared to other $1000 HMI displays like Samsung

Not only is it less expensive,

  - but human readable Nextion Instruction Set make programming it easy.

    t0.txt="124"ÿÿÿ  can it be stated more simple?  Status is a breeze, No?

But what the Human interaction?

   How to notify MCU of user interaction and press/release on the screen?

   A checkbox in Press Event and one in Release Event.

   Send Component ID checkbox notifies MCU exactly what occurred

      On this page, this component was (pressed/released)

Nextion side GUI is completed within a hour and off to the MCU side coding.

"Nextion offers a new and easy way to interface, help to make GUI easier".

   Indeed just 2 wires to connect RX/TX not 40 pins and graphic drivers

                   Indeed this is easy - how can it be any easier?

All MCU side programming requires thought logic and the work to program.
Nextion isn't revolutionizing how an MCU gets programmed, that's crazy.
There are over 10,000 MCUs that have serial or can simulate serial
There are over 100 programming languages
And I am sure well over 500 compilers for all of these languages

There isn't one magic pill that all of a sudden makes all ST/PIC/AVR MCUs
now instantly compatible and one instruction is the same for all of them.
Though I think Arduino is acctually working towards such an effort,
   they started with a couple AVR class chips - only 10,400 to go.

So Itead released a library for the Nextion - Iteadlib Arduino Nextion Library
  since to change a text component (t0.txt="123"ÿÿÿ) then they parse
NexText mcuside_name = NextText(0,1,"page0.t0");
    - they include .setText() function so variable can be passed to it
    - currently components have a member function for each dynamic attribute
  string cmd = "t0.txt=\"123\"";
  But sendCommand(cmd);  will accomplish the same thing.
sendCommand can send any valid Nextion non block instruction.
 ( blocking are if, for, while style statements requiring braces {} )

I am not certain that this isn't extremely easy compared to native MCU programming.
It is structured for any Nextion side corresponding component
  touch events for press/release are defined
    .attachPush() and detachPush() are Press Events (listen, or stop listening)
    .attachPop() and detachPop() are Release Events (listen, or stop listening)
   nex_listen_list says what MCU is currently monitoring events for.

Main configuration is in NexConfig.h
Tweeks in NexHardware.cpp
and one nexInit() call in setup()
and one nexLoop() call in loop()

There are plenty of Examples
 - included in the examples folder of the IteadLib
 - Nextion user manual (updating) thread in Announcements
   These walk you through basic to more advanced.

So what is a clear way for the customer.
  - what you desire to do with your MCU in a project is ...
    very specific to your MCU, your project in your language on chosen compiler.
Nextion is far broader than one language, one compiler, one MCU
   It is 100+ of languages, 1000's of MCUs, 1000's of varied projects

But you assessment has to be properly and fairly stated
 - you blame your screws and nails for being to complex
   but it is your project that is complex and it may use a few screws and nails
   but it is not the screws and nails themselves that are complex

Likewise - the Nextion side of a GUI HMI is indeed easy.
 - HMI side completed within hours
I did a 1200 user defined Menu - 30 pages x 40 menu item
  2400 event (2 each menuitem) in Arduino
3 hours HMI side, ~9 hours Arduino side for framework

The complexity of writing 2400 event functions MCU side
    does not make the Nextion less easy.

On a different note
 - users found that the Nextion was even more capable than advertised
 - Nextion is not only able to handle graphic and font resources
   but also capable of processing its own logic
 - any complexities in Nextion side logic is out of scope of HMI
   it is user choice to try and implement Nextion side logic.
The user can also just as easy (and even easier)
    implement the MCU side method and process MCU side
    and the easiness is restored.

Evaluating Nextion is not based on user's skill to program their MCUs
     t0.txt="123"ÿÿÿ  (Status) and
     check off Send Component ID (Request)
  should indeed be within everyones skill set.

I completely agree with you, I already had a couple of displays here, but when I saw this one saying it would be very easy to program the code and waste time looking for how it works "Nextion offers a new and easy way to interface, help to make GUI easier".

I ended up buying, but now I'm sorry for the purchase, because it has not made it any easier to see it, I keep looking for code and using google to see if anyone helps anything. And worse is that it is very little documented, only with the basics of the basics, which is insufficient for anyone who needs to grasp a project developed for example in arduino and put it on the display.

This is what this company is not understanding, that people buy this display because it promises to be easy, not because it is cheap or because there are no more displays in the market, it is precisely the opposite, but even so do not help those who need information.

Another thing the editor is easy to work is true, the problem is to put it in a way to work with microcontrollers, was not it to be easy to work and waste less time with programming?

It's what you promise, but you do not deliver at the end of the day. Negative point for you, at least since they do not have videos, books or tutorials with the material, try to explain things to your customers in a clear way.

No one is still here looking for code done, but ways to use your display correctly and useful, otherwise your project is useless.

1 person likes this

Well it seems that you got a lot further than I did. I cant even get an Arduino sketch to upload without tons of errors. I I'm using the Nextion Arduino Library, but I'm not sure if it's the right one the Wiki documentation is so screwed up that I can't tell what's right or what's wrong. I just don't know and their Tech support well, that's a whole new treat in itself.

I am trying to do the same thing..Can you provide any details or code on how you did that
I want to use the touch screen to control a 4 channel relay to some lights throughout my house to start with
I have a Mega2560 and an extra UNO laying around, I could use either one.



I am using the following method to intercept press events:

void loop() {

 while (Serial.available()) {

  if (charflag) {

   UN = 1000;


   char1 =;


   char2 =;


   char3 =;

   DecodeStr = "";

   DecodeStr = String(char1) + String(char2);

   UN = DecodeStr.toInt();

   Serial.print(" UN = ");




   charflag = 0;




   char1 =;

   if (char1 == 0x65) charflag = 1;


  switch (UN)

   if (doStop == false)


  case 1: // Page0 press open Main Menu

   UN = 500;

   // ....add your case values here


   //...... some more cases




Matt, you would please share your project files with us?

Hi,you can see the User manual here:


NEXTION with UART connection to EDITOR has been explained.

Nothing however how to connect to Arduino (hardawre/Software).

A video with no spoken comments and fast clicks is not doing the job.

Step by step Tutorial will boost your business for Arduno customers.

Seems you are hard pushing the busines with tons of propaganda and the full documentation is not ready for publishing yet.

Your help will be highly apreciated.  Regards, Gerry

5 people like this
I am using a nano at the moment (5v, gnd, D0/Tx, D1/Rx), but it should be the same for the UNO, just work out the equivalent pins.

1 person likes this

How do you hook it up to the arduino UNO?

I feel the same way, very little explanation...... I have been poking around with there Arduino & have got a 2.4 screen working with 5 buttons (Home Automation). It basically has a light button & 4 buttons to control a ceiling fan, its early days but I got it working :).

I have a pic of the screen & a video of it working (see below).



3 people like this

Like what do i put in the "user code" on touch release event to send even a number like "102" so then the Arduino can do something if it receives that command number.

It's easy. 

1. put a button into your screen:

2. Click your button, you can see the "Touch Press Even","Touch Release Even" ?

---- Try use the even to jump to other page or sent out what you need (

a clock or maybe some pic viewer but my nextion is dead.