Start a new topic

Nextion/Arduino - get system variable values without text or number component

Hi! Is it possible to recieve on arduino, Nextion system variable values, such as sysx, rtcx, with no need to use text or number components? The benefit of such way could be to get actual value at any time, independent from active page or etc. Maybe ther is such a Arduino library for enhanced model RTC?

I use enhanced 3.5'' nextion with arduino mega.

just try it out ...

get: Get variable/constant value with format


Ok, but must I do this using library nextion.h, etc.,  or by use hex command codes, preference to get data in number format and using library, but in Itaed/Nextion github, I couldn't find such coding examples!?

 just send it plain serial ...

Hi, sorry for disturbing!

I wrote such code in loop section:

Serial2.print("get rtc3");     //arduino MEGA Nextion serial




  if (Serial2.available() > 0){;

    Serial.print("got it! ");



....and nothing happens;(

p.s.It's a part of code, other things - sending numbers to Nextion and recieve numbers and text from Nextion is working!

oh plenty happened

 - mcu executed code exactly as written

Just not the result you were looking for

   to get that expected result

have to write the code to do so

Hi, I suppose, that Nextion didn't act this get command sent by serial, could You explain, how to execute this request from arduino, if it's either possible!?

It is of course possible.  With or without Iteadlib Arduino Nextion Library.

Choosing without Iteadlib Arduino Nextion Library

  to me says user wants to try to deal with on his own

Look at each line of code

   realize loop() is or should be running at least at baud

What happens every loop when it hits this line with each byte?

    if (Serial2.available() > 0) { 

And on Mega's what is it 8MHz clock or 16MHz clock

 - what is time for Nextion to process

With only snippet, I am assuming you nailed it down to this region

that is failing to work and that you have some type of proof.

I am also assuming that you are not using the Iteadlib

 - if you were you would use commands from Iteadlib rather than

   try to do it so manually.

If Iteadlib is being used, then nexLoop is also in loop()

  - and nexLoop is what processes incoming.

So you probably created a conflict of who is in control of those incoming bytes

    nexLoop() vs your Serial2.available()

But for sure MCU is doing exactly as instructed

Hi! Yes, I use itead library, but dont use nexloop, I only send numerical data to nextion pages. About 16 mhz, for this command i use subloop run for 1000ms! When I put this get rtc command in nextion with timer event, arduino receive this data. You said there is command for send commands to nextion with nextion.h library, I haven't found any command list!?

All of the Iteadlib is an example 

  In the Component.h/.cpp files

  Component.getValue() shows how to get a numeric value

     it basically parses out to the text command and terminates 0xFF requirements.

  Component.setValue() shows how to get a text value


  In nexHardware.h/,cpp

     sendCommand() can be used to send any command




  Command List is Nextion Instruction Set - see Nextion TTL Serial

But there is more to your code than the snippet shows

   Register to Buffer is handled somewhere

         if not nexLoop() then you made in your code somewhere

Put a Serial.print("sent it ..") before your get rtc3 line

  - determine this code segment is even being called.

Thanx, I'll try it tomorrow!

Hi, finaly stay with such code, and run it periodicaly, it worked, but is it optimal, I don,t like thes delays, is there some other way?

void gettime() {

sendCommand("get rtc3"); 

sendCommand("get rtc4");


 if (nexSerial.available() > 0) {


    while (nexSerial.available() > 0) {

      for (int i = 0 ; i < 16; i++) {

        array[i] =;








Hi! I got it worked, but  only with sendCommand(), tried with nexSerial and no result!

I mention, that serila read is unstable, but putting serial print before read, resolve that, is it that You said about calling?

Anyway, it would be better, if You pay more attention to this side of instructions due to moust users buy such displays for use with consumers type MCU's laike Arduino and who's not so skilled in programming field! And would be nice to have Nextion enhanced RTC library!

Tnx for helping!

Read the receive buffer until the expected answer is received or a timeout is reached.


I just added a comment to your code, just to explain what the code does.

You you actually should do is (1) purge/clear the receive buffer, (2) send the get rtc3, (3) read the receive buffer until the expected answer is received or a timeout is reached.  

Serial2.print("get rtc3");     //arduino MEGA Nextion serial
  if (Serial2.available() > 0){ //there is nothing available _immediately_, this block will never run;
    Serial.print("got it! ");


Login or Signup to post a comment