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.
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,
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.