Nextion not responding to 'get' commmands

Hey all, I’m new to Nextion so I’m hoping this is simply user error.
I have an NX4024T032 interfaced with an Elegoo Uno. I can change on-screen elements using print statements from my Uno, but ‘get’ commands return nothing at all.

I cannot connect to the MCU in debug mode of the Nextion Editor, so debugging is a bit more difficult.
From what I can, tell this is due to limitations put in place by my IT admin since I am using my work PC as it is the only Windows machine I have access to. (Feel free to make suggestions on this matter if you have any). The debugger shows the expected command on the return side.

It’s worth mentioning that, as soon as I press a button on the display that executes its own print statement, I then see the response to my original ‘get’ request and the button’s print statement.

Anyways, this is what I have. Executed directly in the loop function

if (Serial2.available() > 0) {
    String input = "";
    while (Serial2.available()) {
      input += char(;
    Serial.println("Serial2 input: " + input);
    if (input.substring(0,9) == "Whatismy ") {
      String requestRx = input.substring(9);
      String requestTx = "";
      if (requestRx == "mode") {
        requestTx = "get Globals2.motorStatus.txt";
      } else if (requestRx == "position") {
        requestTx = "get Globals2.motorPosTxt.txt";
      } else if (requestRx == "speed") {
        requestTx = "get Settings.motorSpeedRead.txt";

      String stage = "Get Request";
      if (stage == "Get Request") {
        stage = "Get Response";
      if (stage == "Get Response") {
        if (Serial.available() > 0) {
          String response = "";
          while (Serial.available()) {
            response += char(;
        stage = "Get Request";

I know none of these should have worked, but I tried including these anyways:

  • Serial.print(“code_c”);
  • Serial.print(“sleep=0ÿÿÿ”);
  • Serial.print(“com_star”);

What am I missing? Any other ideas? TIA!

UPDATE: SoftwareSerial cannot send and recieve at the same time, so I moved the print statements to after “if (Serial2.available())” and I now get a response from the Nextion, but it looks to just be a space or carriage return maybe?

Hi @abredall,

It seems as if there‘s no waiting for a reply. You send a request and immediately check whether Nextion has replied to it. This doesn‘t work because Nextion requires some time to process the command.
Therefore the usual approach is to wait with a timeout, meaning you have a loop that waits til either a complete response has been received or more time has elapsed than allowed. Whether you wait for a response to complete or to begin depends on your preference. The first one automatically catches aborted/incomplete commands as well while the second one allows for shorter timeouts.

Kind regards,

Even better, start a timer when sending a request and check its expiration in the main loop between other firmware work.
Waiting for something for a long time (more than a few hundred microcontroller cycles) is a bad form and you can use this technique only if something critical is expected, without which nothing else can be done.