Hey guys I got problem about my project I upload all I need in this project but it show
'class Nextion' has no member named 'setComponentText' and
'class Nextion' has no member named 'init' how can I fix it?
#include <ArduinoComponents.h>
#include <Nextion.h>
#include <Arduino_JSON.h>
#include <ArduinoJson.h>
DynamicJsonDocument doc(1024);
#include <EEPROM.h>
#include <SoftwareSerial.h>
#include <Nextion.h>
String message;
int k=0;
SoftwareSerial nextion(2, 3);// Nextion TX to pin 2 and RX to pin 3 of Arduino
Nextion myNextion(nextion, 9600); //create a Nextion object named myNextion using the nextion serial port @ 9600bps
int ReadEPROM;
int ReadEPROM2;
void setup() {
Serial.begin(115200);
myNextion.init();
for(int i=0;i<18;i++){
int Add=doc["add"][i];
int Pos=(i+1)*10;
ReadEPROM=EEPROM.read(Pos);
myNextion.setComponentText("np"+String(i), String(ReadEPROM));
Serial.println(ReadEPROM);
}
}
void loop() {
message = myNextion.listen(); //check for message
if(message != ""){ // if a message is received...
Serial.println(message);
String inputString = message;
int startIndex = inputString.indexOf("{"); // Find the index of the opening brace
int endIndex = inputString.indexOf("}"); // Find the index of the closing brace
String orderString = inputString.substring(startIndex, endIndex + 1); // Extract the substring, including the braces
deserializeJson(doc,orderString);
Serial.println(orderString);
k=1;
}
if(k==1){
int Pre_Order = doc["o"][0];
Serial.print("Pre_Order :");
Serial.println(Pre_Order);
int Pre_Order1 = doc["r"][0];
Serial.print("Pre_Order :");
Serial.println(Pre_Order);
int Pre_Add = doc["a"][0];
Serial.print("Pre_Add :");
Serial.println(Pre_Add);
int Pre_Add1 = doc["b"][0];
Serial.print("Pre_Add1 :");
Serial.println(Pre_Add1);
int Pre_Reset = doc["r"][0];
Serial.print("Pre_Reset :");
Serial.println(Pre_Reset);
if(Pre_Order==1){
for(int i=1;i<=18;i++){
int order=doc["o"][i];
int Pos=(i)*10;
ReadEPROM=EEPROM.read(Pos);
int Add = ReadEPROM-order;
EEPROM.write(Pos,Add);
ReadEPROM=EEPROM.read(Pos);
myNextion.setComponentText("ontime", "1");
Serial.print("ReadEPROM :");
Serial.println(ReadEPROM);
Serial.print("Order :");
Serial.println(order);
delay(100);
if(order==0){
myNextion.setComponentText("t"+String(i-1), "-");
}
else{
myNextion.setComponentText("t"+String(i-1), "P");
}
// Serial.println(Name);
}
}
else if(Pre_Add==1){
for(int i=1;i<=9;i++){
int Add=doc["a"][i];
int Pos=(i+9)*10;
EEPROM.write(Pos,Add);
ReadEPROM=EEPROM.read(Pos);
// myNextion.setComponentText("np"+String(i-1), String(ReadEPROM));
Serial.print("ReadEPROM :");
Serial.println(ReadEPROM);
}
}
else if(Pre_Add1==1){
for(int i=1;i<=9;i++){
int Add=doc["b"][i];
int Pos=(i)*10;
EEPROM.write(Pos,Add);
ReadEPROM=EEPROM.read(Pos);
// myNextion.setComponentText("np"+String(i-1), String(ReadEPROM));
Serial.print("ReadEPROM :");
Serial.println(ReadEPROM);
}
}
else if(Pre_Reset==1){
for(int i=0;i<18;i++){
int Pos=(i+1)*10;
ReadEPROM=EEPROM.read(Pos);
myNextion.setComponentText("np"+String(i), String(ReadEPROM));
Serial.println(ReadEPROM);
}
}
myNextion.setComponentText("status", "Empty");
message="";
k=0;
}
}
Here is my code