Nextion Arduino library provides an easy-to-use method way to manipulate Nextion displays series. Users can use the library freely, either for commercial projects or for open-source projects, without any additional conditions.
There are ten examples in our library now. We will keep updating with more examples. Please visit our examples here.
The latest source code (master branch) can be downloaded here.
To discuss the project, request a new feature or report a BUG? please visit Nextion Forum.
Download Source Code
The latest version is unstable and a lot of changes may be applied in a short time interval without any notification to the users. Usually, this library is for developers only.
A release version is recommended for you unless you are one of the developers of this library.
Find Release notes here.
Latest (unstable) version
You can also clone it via git:
Release (stable) version
We provide two library formats in the release version: the first one is the normal format while the second is suitable for developers.
Find history releases versions here.
All boards, which have one or more hardware serial, can be supported.
♦ Iteaduino MEGA2560
♦ Iteaduino UNO
♦ Arduino MEGA2560
♦ Arduino UNO
In configuration file NexConfig.h, users can find two macros below:
♦ dbSerial: Debug Serial (baudrate:9600), needed by beginners to debug their nextion applications or sketches. If users complete their work, it will be a wise choice to disable Debug Serial.
♦ nexSerial: Nextion Serial, the bridge between Nextion and mainboard.
Note: the default configuration is for MEGA2560.
Redirect dbSerial and nexSerial
If users want to change the default serial to debug or communicate with Nextion, they need to modify the line in configuration file NexConfig.h
#define dbSerial Serial ---> #define dbSerial Serialxxx #define nexSerial Serial2 ---> #define nexSeria Serialxxx
Disable Debug Serial
If users want to disable the debug information, they need to modify the line in configuration file NexConfig.h:
#define DEBUG_SERIAL_ENABLE ---> //#define DEBUG_SERIAL_ENABLE
If the user’s board has only one hardware serial, such as UNO, they should disable dbSerial and redirect nexSerial to Serial (Refer to section: Serial configuration).
To help users quickly get started, we are now taking CompButton.ino as an example to show you how to to use the library. Users may download it and practice as we instruct.
First of all, open Com pButton in Examples. Users will see there are three files: HMI file, ino file and tft file.
1. Open and debug the CompButton. HMI in Nextion Editor, then click “upload”.
2. The tft.file is generated automatically by compiling the HMI file in Nextion Editor. Nextion also supports downloading projects with tft file by SD card(within 2G).
3. Open CompButton.ino, copy all the source codes to Arduino IDE and download to your Arduino.
View more comprehensive information at application examples.