Introduction
Nextion Arduino library provides an easy-to-use way to manipulate Nextion displays series. Users can use the library freely, either for commercial projects or open-source projects, without any additional conditions.
There are 10 examples in our library now. We’ll keep updating with more examples. Please visit our examples here: https://github.com/itead/ITEADLIB_Arduino_Nextion/tree/master/examples
Latest source code(master branch) can be downloaded here: https://github.com/itead/ITEADLIB_Arduino_Nextion
To discuss the project? Request new feature? Report a BUG? please visit Nextion Forum:http://support.iteadstudio.com/support/discussions
Download Source Code
Latest version is unstable and a mass of change may be applied in a short time without any notification to users. Commonly, this library is for developers particularly.
Release version is recommended for you, unless you are one of developers of this library.
Find Release notes here:
https://github.com/itead/ITEADLIB_Arduino_Nextion/blob/master/release_notes.md
Latest(unstable) version
You can also clone it via git:
git clone https://github.com/itead/ITEADLIB_Arduino_Nextion
Release(stable) version
We provide two library formats in release version, the first one is normal format, the second is suitable for developer.
♦ https://github.com/itead/ITEADLIB_Arduino_Nextion/archive/v0.7.0.zip
♦ https://github.com/itead/ITEADLIB_Arduino_Nextion/archive/v0.7.0.tar.gz
Find history releases versions here:
https://github.com/itead/ITEADLIB_Arduino_Nextion/releases
Suppported Mainboards
All boards, which has one or more hardware serial, can be supported.
For example:
♦Iteaduino MEGA2560
♦Iteaduino UNO
♦Arduino MEGA2560
♦Arduino UNO
Configuration
In configuration file NexConfig.h, you can find two macros below:
♦dbSerial: Debug Serial (baudrate:9600), needed by beginners for debug your nextion applications or sketches. If you complete your work, it will be a wise choice to disable Debug Serial.
♦nexSerial: Nextion Serial, the bridge between Nextion and your mainboard.
Note: the default configuration is for MEGA2560.
Redirect dbSerial and nexSerial
If you want to change the default serial to debug or communicate with Nextion , you need to modify the line in configuration file
#define dbSerial Serial ---> #define dbSerial Serialxxx #define nexSerial Serial2 ---> #define nexSeria Serialxxx
Disable Debug Serial
If you want to disable the debug information, you need to modify the line in configuration file:
#define DEBUG_SERIAL_ENABLE ---> //#define DEBUG_SERIAL_ENABLE
UNO-like Mainboards
If your board has only one hardware serial, such as UNO, you should disable dbSerial and redirect nexSerial to Serial(Refer to section:Serial configuration).
Example-Button
To help you quickly get started, we are now take CompButton.ino as example showing you how to to use the library. You may download it and practice as we instruct.
First of all, open Com pButton in Examples.You 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 project 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.
Useful Links
View more comprehensive application examples:
http://blog.iteadstudio.com/nextion-tutorial-based-on-nextion-arduino-library/