How to printing string and text in sexton display at the same time?

Is there a way to print a string and text from arduino to nextion display at the same time?

for example, can I use like this
myNextion.setComponentText("t0", "the value is " ,String(sensor) );
I tried to use this but gives me an error, is there a another way?

The error message would be information that would help us to help you. Read the forum guidelines to see how to post code and errors and some advice on using the forum.

Hello ambusaidi,

Try this:

void setup() {
  Serial.begin(9600);   // Serial moniitor port.
  Serial1.begin(9600);  // Serial port 1 for the Nextion, change if needed to the serial port you are using.

void loop() {

void NextionTest() {
  static uint32_t lastMillis;
  const uint32_t interval = 500;
  static uint8_t someVariable;
  if (millis() - lastMillis > interval) {
    lastMillis += interval;

Note this assumes:

  • You have a text box t0
  • Your Nextion is connected to serial port 1
  • You have set the baud rate on the Nextion to 9600 (or not changed it from the default)

Also note this is without the Nextion library, which I do not use.