Could someone who knows something about nextion displays and is good at making arduino "programs" please write me basic program for transfering input string from software serial (temperature, pressure and humidity from another arduino over hc-12 rf modules) that is set to pins 10,11(TX,RX) to text box (it is on page 0, its id is 13 and its label is t4) on nextion display. I would really appreciate if someone would do it for me, because that would remove barrier in my project and from that I could learn and develop my knowledge about nextion displays. If you need more information just ask.
if you use the arduino library, in general all you need to do is declaring the nextion object with:
NexText yourTextBox = NexText(0, 13, "t4");
then you simply need to send the text you want to visualize with:
yourTextBox .setText(yourMessage);
note that yourMessage must be a char, you can convert a string to char with:
char yourMessage[25];
yourString.toCharArray(yourMessage, 25) ;
this assumes the length of text in the textBox you set in the nextion editor is 25, otherwise change accordingly
Hope this helps
note that yourMessage must be a char, you can convert a string to char with:
What A Load Of Horsecrap.
yourMessage must be a string - a NULL-terminated ARRAY of char(s).
You can convert a String to a string, using toCharArray, but that is NOT necessary. The c_str() method will expose the wrapped string without the need to copy it, for passing to any function that takes a string but does not alter it.
PaulS:
What A Load Of Horsecrap.
Well Paul, before offending people you should try to send a string to nextion and see what happens...
cloxart:
try to send a string to nextion and see what happens...
That should work just fine, based on what I see in the code above.
However sending a String... (now you go find out the HUGE difference between string and String).