Error 'Nextion' does not name a type; Any hellp?

@PerryBebbington
Hello friends
its the first time for me to use nextio screen
and i got this error

Arduino: 1.8.19 (Windows 10), Board: "Arduino Uno"
hydrotest1:11:1: error: 'Nextion' does not name a type; did you mean 'NexGpio'?
 Nextion myNextion(Serial3);
 ^~~~~~~
 NexGpio
C:\Users\said-\OneDrive\Documents\hydrosystem\hydrotest1\hydrotest1.ino: In function 'void setup()':
hydrotest1:53:3: error: 'myNextion' was not declared in this scope
   myNextion.begin(9600);
   ^~~~~~~~~
C:\Users\said-\OneDrive\Documents\hydrosystem\hydrotest1\hydrotest1.ino: In function 'void loop()':
hydrotest1:62:3: error: 'myNextion' was not declared in this scope
   myNextion.setComponentText("t0", String(currentTemperature));
   ^~~~~~~~~
Multiple libraries were found for "SPI.h"
 Used: C:\Users\said-\OneDrive\Documents\Arduino\libraries\SPI
 Not used: C:\Users\said-\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\SPI
Multiple libraries were found for "SD.h"
 Used: C:\Users\said-\OneDrive\Documents\Arduino\libraries\SD
 Not used: C:\Program Files (x86)\Arduino\libraries\SD
exit status 1
'Nextion' does not name a type; did you mean 'NexGpio'?
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

and this is the code i make

#include <Wire.h>
#include <Nextion.h>
#include <EEPROM.h>

#define TEMPERATURE_SENSOR_PIN A0
#define FAN_RELAY_PIN 33
#define EEPROM_TEMPERATURE_ADDRESS 0
#define EEPROM_TEMPERATURE_LOW_ADDRESS 4
#define EEPROM_TEMPERATURE_HIGH_ADDRESS 8

Nextion myNextion(Serial3);
int currentTemperature = 0;
int setTemperature = 10;
int setTemperatureLow = 5;
int setTemperatureHigh = 15;

void readEEPROMValues() {
  setTemperature = EEPROM.read(EEPROM_TEMPERATURE_ADDRESS);
  setTemperatureLow = setTemperature - 5;
  setTemperatureHigh = setTemperature + 5;
}

void writeEEPROMValues() {
  EEPROM.write(EEPROM_TEMPERATURE_ADDRESS, setTemperature);
  EEPROM.write(EEPROM_TEMPERATURE_LOW_ADDRESS, setTemperatureLow);
  EEPROM.write(EEPROM_TEMPERATURE_HIGH_ADDRESS, setTemperatureHigh);
}

void incrementTemperature() {
  setTemperature += 10;
  setTemperatureLow = setTemperature - 5;
  setTemperatureHigh = setTemperature + 5;
  writeEEPROMValues();
}

void decrementTemperature() {
  setTemperature -= 10;
  setTemperatureLow = setTemperature - 5;
  setTemperatureHigh = setTemperature + 5;
  writeEEPROMValues();
}

void fanControl() {
  if (currentTemperature > setTemperature) {
    digitalWrite(FAN_RELAY_PIN, HIGH);
  } else {
    digitalWrite(FAN_RELAY_PIN, LOW);
  }
}

void setup() {
  Serial.begin(9600);
  myNextion.begin(9600);
  readEEPROMValues();
  pinMode(TEMPERATURE_SENSOR_PIN, INPUT);
  pinMode(FAN_RELAY_PIN, OUTPUT);
}

void loop() {
  currentTemperature = analogRead(TEMPERATURE_SENSOR_PIN);
  fanControl();
  myNextion.setComponentText("t0", String(currentTemperature));
  myNextion.setComponentText("t1", String(setTemperature));
  myNextion.setComponentText("t2", String(setTemperatureLow));
  myNextion.setComponentText("t3", String(setTemperatureHigh));

  if (myNextion.isTouchEvent()) {
    if (myNextion.getTouchEvent().event == 0) {
      if (myNextion.getTouchEvent().componentId == 0) {
        incrementTemperature();
      } else if (myNextion.getTouchEvent().componentId == 1) {
        decrementTemperature();
      }
    }
  }
}

Any help please

@alfahad73 ,
You have mentioned me, presumably because of my Nextion tutorial. If read my tutorial you will know I don't use the Nextion library. I can only help if you use the methods I set out in the tutorial.

I apologize for that

I read your tutorial, but because this is the first time I use a Nextion Screen, I don't understand which library to use and how to use it.

anyway thanks @PerryBebbington

That depends on you and your project.

If you found an example and don't care about that there is a delay in the Nextion library, then you can use the Nextion library.

Everyone who uses the Nextion library for a while, starts looking for something better. If you have programming experience, and understand the communication between the Arduino board and the Nextion display, then follow the tutorial by PerryBebbington.

If you are planning a big project with multiple pages on the Nextion screen, and you have programming experience and know how to do big projects, then don't waste your time with the Nextion library.

I started with the Nextion library, but I had to fix a few things. Then I improved a few things. After a while my code did not have anything left from the Nextion library :rofl:

I don't use any library for the Nextion. If you want a solution using a library try Easy Nextion Library . I don't know anything about it, but I have seen a lot of comments suggesting it works well.

sound good
As I said earlier, this the first time I use a Nextion Screen and I am not programming experience
Just trying to learn something new

Thanks PerryBebbington for the advice to use [quote="PerryBebbington, post:5, topic:1086246"]
Easy Nextion Library
[/quote]
I will try it

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.