I am interfacing Nextion display with Arduino MKR board. In that if I assign some text to a text component it displays the text, but if I change the text based on smoe condition, it still shows the previous text.. Also in Nextion programming, How to overwrite the value of a text component. Scope of the page and text component is global so that it can be accessed anywhere in the program.
making page component global only allows to change either background image or background color at runtime depending on .sta attribute. Otherwise it is a waste to make page component global.
okay, I tried with making page global so its components can be accessed anywhere but if that doesn't work this way its fine. My real issue is to overwrite the text component..
How can I perform this.
perhaps the setText Function Arduino side or t0.txt="Hello" Nextion side.
I used setText function on arduino, but its not overwriting the previous text.
Examine the code in your component (NexText.cpp/NexText.h)
So if all setText does is parse from your component declaration to add .txt="<text>"
and then calls sendCommand
Examine the code in NexHardware.cpp/NexHardware.h
to see that sendCommand simply parses what is passed and adds the data termination
Calculate what is actually being sent to the Nextion.
Take this string that you have calculated
try inputting that string in your User Input Area while in Debug mode
check if such a string is correct and accepted.
Recheck in the User Input Area with a get statement and see what Nextions value is now.
An MCU will only do exactly as instructed to do
use your debugging tools to investigate and see what you are actually sending
The whole reason for the Arduino Serial Monitor and wasted Serial is to provide you a means to monitor what is happening as it happens - so perhaps craft a print to your Serial so you can see.
I bet there is something your have left out of your statement