String to Nextion

Hi guys
I`m trying to make my head around this issue. (Nextion is no help)
I have a text box g0 on the screen.

I`m trying to send the char to the screen depends on what is happening.
This one is sending error

char errorMessage[30] = {"Unable to execute operation"};

This one clears the message

char clearMessage[5] = {"””"};

When i use a arduino Serial i can see it is printing to the serial no problem

   Serial.println(errorMessage);

But this dosn`t seems to be working well when it comes to nextion

  Serial1.print("g0.txt=");
  Serial1.print(clearMessage);
  Serial1.write(0xff);
  Serial1.write(0xff);
  Serial1.write(0xff);

Further to that, i`m sucsesfully sending Enable/disable text field with

  Serial1.print("g0.en=0");
 Serial1.write(0xff);
 Serial1.write(0xff);
 Serial1.write(0xff);

Anybody can suggest where can the issue be?

Thanks

But this dosn`t seems to be working well when it comes to nextion

Only you can see what it actually does.

Apologies
text function

//Text parameters  page #, component .id, component .objname
NexText g0 = NexText(2, 16, "g0");
const int LiftOperationTime = timeOut;

byte HysteresisLift = HysteresisVal; // the differnce btw the stored EEPROM value and the actual sensorValue/car lift. This is to prevent to much valve swiching while lifting or lowering

//The default sensors used are "LEVEL SENSORS". If only PRESSURE sensors to be used, they have to be wired in LEVEL sensor plug slot and mapFloat offsets adjusted. Refer to YouTube videos.
void autoLift(void)
{
  g0.setText(clearMessage);
  Serial1.write(0xff);
  Serial1.write(0xff);
  Serial1.write(0xff);
  Cancel = 0;
  bool liftedAll = false;
  bool liftedFL = false;
  bool liftedFR = false;
  bool liftedRL = false;
  bool liftedRR = false;
  bool failed = false;
  unsigned long liftStartTime;
  liftStartTime = millis();

  while (!liftedAll) {

    Serial1.print("bt5.val=1");
    Serial1.write(0xff);
    Serial1.write(0xff);
    Serial1.write(0xff);
    nexLoop(nex_listen_list);

    updateLiftSensor();
    updatePressureSensor();
    updateTankPressure();

    //Lift FL if below target height
    if (!liftedFL && (liftSensorValueFL < (readDriveMemFL - HysteresisLift))) {

      currentMillisFL = millis();

      if (digitalRead(flup) == HIGH && currentMillisFL - startMillisFL >= LiftONtimeFront)
      {
        digitalWrite(flup, LOW);
        startMillisFL = currentMillisFL;
      }
      else if (digitalRead(flup) == LOW && currentMillisFL - startMillisFL >= LiftOFFtimeFront)
      {
        digitalWrite(flup, HIGH);
        startMillisFL = currentMillisFL;
      }

    }

    //Or lower FL if above target height
    else if (!liftedFL && (liftSensorValueFL > (readDriveMemFL + HysteresisLift))) {
      currentMillisFL = millis();

      if (digitalRead(fldown) == HIGH && currentMillisFL - startMillisFL >= LowerONtimeFront)
      {
        digitalWrite(fldown, LOW);
        startMillisFL = currentMillisFL;
      }
      else if (digitalRead(flup) == LOW && currentMillisFL - startMillisFL >= LowerOFFtimeFront)
      {
        digitalWrite(fldown, HIGH);
        startMillisFL = currentMillisFL;
      }
    }

    //Or stay still if in target height
    else {
      digitalWrite(flup, LOW);
      digitalWrite(fldown, LOW);
      liftedFL = true;
    }

    //Lift FR if below target height
    if (!liftedFR && (liftSensorValueFR < (readDriveMemFR - HysteresisLift))) {

      currentMillisFR = millis();

      if (digitalRead(frup) == HIGH && currentMillisFR - startMillisFR >= LiftONtimeFront)
      {
        digitalWrite(frup, LOW);
        startMillisFR = currentMillisFR;
      }
      else if (digitalRead(frup) == LOW && currentMillisFR - startMillisFR >= LiftOFFtimeFront)
      {
        digitalWrite(frup, HIGH);
        startMillisFR = currentMillisFR;
      }

    }

    //Or lower FR if above target height
    else if (!liftedFR && (liftSensorValueFR > (readDriveMemFR + HysteresisLift))) {
      currentMillisFR = millis();

      if (digitalRead(frdown) == HIGH && currentMillisFR - startMillisFR >= LowerONtimeFront)
      {
        digitalWrite(frdown, LOW);
        startMillisFR = currentMillisFR;
      }
      else if (digitalRead(frup) == LOW && currentMillisFR - startMillisFR >= LowerOFFtimeFront)
      {
        digitalWrite(frdown, HIGH);
        startMillisFR = currentMillisFR;
      }
    }

    //Or stay still if in target height
    else {
      digitalWrite(frup, LOW);
      digitalWrite(frdown, LOW);
      liftedFR = true;
    }


    //Lift RL if below target height
    if (!liftedRL && (liftSensorValueRL < (readDriveMemRL - HysteresisLift))) {

      currentMillisRL = millis();

      if (digitalRead(rlup) == HIGH && currentMillisRL - startMillisRL >= LiftONtimeRear)
      {
        digitalWrite(rlup, LOW);
        startMillisRL = currentMillisRL;
      }
      else if (digitalRead(rlup) == LOW && currentMillisRL - startMillisRL >= LiftOFFtimeRear)
      {
        digitalWrite(rlup, HIGH);
        startMillisRL = currentMillisRL;
      }

    }

    //Or lower RL if above target height
    else if (!liftedRL && (liftSensorValueRL > (readDriveMemRL + HysteresisLift))) {
      currentMillisRL = millis();

      if (digitalRead(rldown) == HIGH && currentMillisRL - startMillisRL >= LowerONtimeRear)
      {
        digitalWrite(rldown, LOW);
        startMillisRL = currentMillisRL;
      }
      else if (digitalRead(rlup) == LOW && currentMillisRL - startMillisRL >= LowerOFFtimeRear)
      {
        digitalWrite(rldown, HIGH);
        startMillisRL = currentMillisRL;
      }
    }

    //Or stay still if in target height
    else {
      digitalWrite(rlup, LOW);
      digitalWrite(rldown, LOW);
      liftedRL = true;
    }



    //Lift RR if below target height
    if (!liftedRR && (liftSensorValueRR < (readDriveMemRR - HysteresisLift))) {

      currentMillisRR = millis();

      if (digitalRead(rrup) == HIGH && currentMillisRR - startMillisRR >= LiftONtimeRear)
      {
        digitalWrite(rrup, LOW);
        startMillisRR = currentMillisRR;
      }
      else if (digitalRead(rrup) == LOW && currentMillisRR - startMillisRR >= LiftOFFtimeRear)
      {
        digitalWrite(rrup, HIGH);
        startMillisRR = currentMillisRR;
      }

    }

    //Or lower RR if above target height
    else if (!liftedRR && (liftSensorValueRR > (readDriveMemRR + HysteresisLift))) {
      currentMillisRR = millis();

      if (digitalRead(rrdown) == HIGH && currentMillisRR - startMillisRR >= LowerONtimeRear)
      {
        digitalWrite(rrdown, LOW);
        startMillisRR = currentMillisRR;
      }
      else if (digitalRead(rrup) == LOW && currentMillisRR - startMillisRR >= LowerOFFtimeRear)
      {
        digitalWrite(rrdown, HIGH);
        startMillisRR = currentMillisRR;
      }
    }

    //Or stay still if in target height
    else {
      digitalWrite(rrup, LOW);
      digitalWrite(rrdown, LOW);
      liftedRR = true;
    }
    if (liftedFL == true && liftedFR == true && liftedRL == true && liftedRR == true) {
      liftedAll = true; //AutoLift function stopped if lift completed
      Serial1.print("page 1");
      Serial1.write(0xff);
      Serial1.write(0xff);
      Serial1.write(0xff); // Change screen to Page1
    }
    if ((millis() - liftStartTime) > LiftOperationTime ) { //AutoLift function stopped if lifting operation cannot be completed in "operationTime". see top for adjustment. Default os 10000 milliseconds (20seconds)
      Serial1.print("g0.en=1");
      Serial1.write(0xff);
      Serial1.write(0xff);
      Serial1.write(0xff);

      g0.setText(errorMessage);
      Serial1.write(0xff);
      Serial1.write(0xff);
      Serial1.write(0xff);

      Serial1.print("bt5.val=0");
      Serial1.write(0xff);
      Serial1.write(0xff);
      Serial1.write(0xff);
      Cancel = 1;
      liftedAll = true; 


    }
    if (Cancel == 1) {
      digitalWrite(flup, LOW);
      digitalWrite(fldown, LOW);
      digitalWrite(frup, LOW);
      digitalWrite(frdown, LOW);
      digitalWrite(rlup, LOW);
      digitalWrite(rldown, LOW);
      digitalWrite(rrup, LOW);
      digitalWrite(rrdown, LOW);
      liftedAll = true;
      Serial1.print("bt5.val=0");
      Serial1.write(0xff);
      Serial1.write(0xff);
      Serial1.write(0xff);

    }
  }
}

There is an example for setText and NexText here

Have you tried it?

We still don't know what that code actually does, or how that differs from what you want it to do.

My bad.
The text field on nextion must be empty. If there is any text (which i had), it cannot be changed with setText function