Nextion Basic NX4832T035 communication Issue with Arduino Mega

Dear All,
I have used the suggestions of Mr. Perry Bebbington to "click" buttons in a Nextion touch screen from Arduino, which are programmed in the Nextion editor to color some images creating a sort of HMI. The initial HMI that i have built was working perfectly.
When I finally finished my code in Arduino, my USB stick crashed and I lost the HMI of the Nextion Editor and I had only the .tft file. So I wrote again the HMI for the Nextion screen, this time with different numbering of the soft Buttons and changed accordingly the code in Arduino. And what a surprise! This time the HMI didn't work. I tried to debbug it, but no luck. I saw that I was using a field in a structure with extension .status, which is a reserved word and corrected it. This didn't resolve the issue. Then I observe that my messages sent from Arduino to Nextion screen are shown correctly, but the clicks of the buttons seem not to work. I am kindly asking for your help.
I attach the Arduino code of my project.
TNK1_TNK2_Mngt_28-10-24-Nextion_28-10-24.ino (42.9 KB)

Thank you all.
This is my first post, and I hope for your help.

I've only just noticed this.

Please put your hmi file in a zip file and upload it. I'll have a look, but it won't be immediately.

Dear Mr. Bebbington,

Please find attached the relative HMI in .zip format.

BR
WMS_ierlh_39-28-10-24.zip (617.6 KB)

Thanks for the code and the HMI file.

It is too complex to work through and find the error(s) as it is, although I did notice that in your HMI file you have attributes that do not match your code, for example in the HMI file you have bt followed by a number but there is nothing in the code to match that.

I suggest you make a small sketch that just clicks one of the buttons and try that. Get it working then slowly add things back in from your original code so as to rebuild the code to match the HMI file.

Can you give me please an example, so to understand better what you mean, with the above.
As soon as I understand your above suggestion, I will built a smaller version to control the HMI and then rebuild the entire code. Please notice that I am able to send text to the Nextion screen with the commands,

      Serial.print(F("t31.txt=\""));  // Error in level readings.
      Serial.print(F(""));
      Serial.print("ERROR LV-EL L1-M0-H1");  // Low is 0 , Middle is 0, High is 1 - ERROR.
      Serial.print(F("\""));
      Serial.write(0xff);
      Serial.write(0xff);
      Serial.write(0xff);

and i cannot "click" the button on my HMI from arduino with the code,

      Serial.print("click b13,1");
      Serial.write(0xff);
      Serial.write(0xff);
      Serial.write(0xff);
      Serial.print("click b13,0");
      Serial.write(0xff);
      Serial.write(0xff);
      Serial.write(0xff);

Thank you.
Best Regards

As far as I can see you do not have a button (or anything else) with the object name of b13, so the reason you can't click it is because it doesn't exist.

Thank you.
I will do the review of the code.

As soon as I have a result I will post it.

Best Regards

1 Like

Thank you very much.... when I am tired I make very errors such as those.
The code works !
Best Regards

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.