Start a new topic

Arduino library which supports ALL Nextion capabilities

The present Arduino library only supports the Nextion functions necessary for the demo screens.  However, when will the library be updated to support all functionality?

- Asynchronous touch events

- Drawing primitives (lines, circles, fill, etc.)

- Support of System Variables functions

- etc.

16 people like this idea

any progress on that ITEAD ?


@Dirk, from another topic:

"The new Arduino Nextion Library ( will release next weekend ~  Let's see if the new version can meet your requirements"


Ok, Arduino is verry popular. But is there no interrest for a standard C/C++ library???

1 person likes this

Arduino is C++ with Wiring extensions for I/O!

Is this weekend the "next weekend" ? ;)

1 person likes this
I think the library should consist of only data construction/deconstruction functions and should let the programmer handle the I/O serial connections. This will allow the library to be used outside of arduino since it will not be tied to arduino I/O functions. For example create a callback system and have a `void parse_message(char *message)` which will deconstruct the user supplied message, and pass the contents to the user defined callback in a structured way. This way users can easily define what happens when a particular message is parsed as well as not be limited to a specific I/O scheme for a platform. I am thinking about creating a library in Ruby for a high level scripting language support for people who wish to use the screens on hardware with more capabilities such as the RPI or other computer hardware. It will support user defined code blocks the parser will call after disassemble of the message is complete. Does anyone have documentation on all the serial input/output strings from the screen? Would make creating a library much easier if I didn't have to force the screen to output each event to try to reverse it.

2 people like this
@abduct That is exactly what I mean. Hierarchical and modular design makes such a library re-usable and target independent. It would also be nice if a HMI design (.tft) can be loaded by the target (include the .tft in the project directory of the application).


1 person likes this


There's a list of output strings on the Wiki site :

About the "Nextion Instruction Set". I have not yet tried this instruction set with my target, only in the "Nextion editor". Can we call the classification 1 commands also from the target (System)? If the classification 2 commands only are restricted for GUI design, it is not possible to do dynamic changes (draw graphs, move objects, etc.). Would be nice!


When you send a command from the Arduino/MCU/target to the display, you must add 0xFF 0xFF 0xFF at the end of the command.

For instance if you type 'page 0' in Nextion Editor 

then the corresponding command from the MCU is 0x70 0x61 0x67 0x65 0x20 0x30 0xFF 0xFF 0xFF

Or if you type 't1.txt="Hello!"' in Nextion Editor

then the command is 0x74 0x31 0x2E 0x74 0x78 0x74 0x3D 0x22 0x48 0x65 0x6C 0x6C 0x6F 0x21 0x22 0xFF 0xFF 0xFF 

You can also see the sendCommand function in the NexTouch.cpp file :

 * Send command to Nextion.
 * @param cmd - the string of command.
void NexTouch::sendCommand(const char* cmd)
    while (nexSerial.available())

 * Init Nextion's baudrate,page id.    
 * @retval true - success. 
 * @retval false - failed. 
bool nexInit(void)
    NexTouch::sendCommand("page 0");  // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    return true;

For the moment, only attributes shown with green color in Nextion Editor can also be changed programmatically (using commands). The attributes in black color can only be changed in Nextion Editor.

x and y attributes are in black color, so it seems like it's not possible to move objects using commands.

A possible solution for moving a text without background color is to remove its content (t0.txt="") and then recreate it (xstr x,y,w,h,fontid,fontcolor,backcolor,xcenter,ycenter,string). It's more difficult for other types of objects. 

Maybe ITEAD could add a command to delete an object ('del t0') 

or add a green attribute called 'vis' (visibility) where 1=visible and 0=invisible.

I moved my talk of the ruby library to:

Please disregard the first two comments since I've just learned how to format my posts on here.
@Raphael Thanks for your help. At this moment I try to use Tera Term as Arduino/target emulator to analyze/test the communication with the Nextion but there is no possibility to send the 3 x 0xFF sequence. Is there a terminal emulator that can do that?


@Wijnand Nijs

Try typing ÿ 3 times (alt+0255)

This should allow you to send 0xFF via the emulator.

@Wijnand Nijs

I also use "ÿÿÿ" in terminal emulator, it works nice.

See picture :

Login or Signup to post a comment