NexButton does not name a type

it does not allow me to compile in arduino create

here I leave the code

// Nextion - Version: Latest
#include <Nextion.h>

#define abrir 2

NexButton abrir = NexButton(1, 2,“b0”);

nexTouch *nex_listen_list() =

void prender_abrir()
digitalWrite(abrir, 1);
digitalWrite(abrir, 0);


void setup() {
pinMode(abrir, OUTPUT);


void loop() {


// /tmp/187472045/sketch_may15b/sketch_may15b.ino:6:1: error: ‘NexButton’ does not name a type

There are multiple problems to resolve here.

This code appears to be written for the" ITEADLIB_Arduino_Nextion" library rather than the Nextion library, as your comment would indicate:

The "ITEADLIB_Arduino_Nextion" library is not in the Arduino Library Manager index, which means you need to import it to the Arduino Web Editor. Unfortunately, that is a somewhat complicated process. Here are the instructions:

  1. Download the library by clicking this link:
  2. Unzip the downloaded file.
    If you're using Windows, you'll get prompted about overriding some files because the repository contains multiple files in the same folder that differ in filename only by case and Windows is filename case-insensitive. You can choose to not overwrite the existing files. It won't cause any problems for the library code itself either way.
  3. Delete the downloaded .zip file.
  4. Open the unzipped folder.
  5. Create a file named
    Unlike the Arduino IDE, the Arduino Web Editor requires that all libraries have a metadata file, and will not import libraries that are missing this file.
  6. Open the file you created using any text editor.
  7. Add the following text to the file:
    author=Wu Pengfei
    maintainer=ITEAD Studio 
  8. Save the file.
  9. This library is HUGE. If you import it as is, it will use up 38 MB of the Arduino Web Editor's total storage limit of 100 MB and take forever to import. To slim it down to a manageable size, I recommend that you delete all the subfolders and the file doxygen.doxy.
  10. Zip the library folder.
  11. In the Arduino Web Editor, click the "Sketchbook" tab on the left side of the screen.
  12. Click the upward pointing arrow button ("Import").
  13. If you get a message about importing your sketchbook, click the Import button.
  14. Select the .zip file of the library.
  15. Click Open button.
  16. Wait until the Arduino Web Editor informs you that the library was imported.

The next problem is that the Arduino Web Editor has all 4000+ Library Manager libraries pre-installed, including a library named "Nextion", which contains a file named Nextion.h. The Arduino Web Editor will use that library instead of the "ITEADLIB_Arduino_Nextion" library your code was apparently written for. Luckily, you can force the Arduino Web Editor to use the correct library by adding the following line to the top of your sketch:

#include <NexButton.h>

That line must come before the #include directive for Nextion.h.

After that, we must deal with the problems in the code.

The first problem is that you are using the name abrir for two different things. A macro:


#define abrir 2

and a NexButton object:


NexButton abrir = NexButton(1, 2,"b0");

You can't do that. Use unique names for each and update the rest of your code accordingly.

Next, you got the name of the NexTouch class wrong. It's "NexTouch", not "nexTouch". The Arduino language is case sensitive. They are not the same things.

You used the wrong syntax in your instantiation of nex_listen_list. You need to use square brackets ([]), not parentheses (()). You can study the library's examples to see the correct way to use the library:

I apologize for the delay in responding, your help has helped me a lot, thank you.
I am sorry for my bad english.

You’re welcome. I’m glad if I was able to be of assistance. Enjoy!

Or you can simply unzip the ITEAD library into a Nextion folder in your Arduino libraries directory, then delete all the sub-directories. It's all the examples in the ITEAD library that take up all that space. The library itself is not terribly large - 182K.

Ray L.