Unofficial Nextion/TJC User Forum

Sending String to Text Field

Good Afternoon,

I have been trying to send a 80 character text string to a text field and have been unsuccessful.

Text field is on page 1, id #5

I send the following from an Arduino:
p[1].b[5].txt=" Active Alarm #01 Emergency Shutdown Discrete Input"
I write this to the display with 0xff, 0xff, 0xff attached to the end.

Do I need to split this up into separate lines? If so, is there a way to choose a line to write to?
I’ve tried inserting CR+LF and that has not worked for me.
Any suggestions would be appreciated.


No need to send a long string. Just use hardcoded strings in hotspot click events.

From Nextion help:
|click|2| Trigger the specified components Touch Press/Release Event
As event code is always local, object can not be page prefixed

usage: click ,
is component’s .id or .objname attribute of component to refresh
is 1 to trigger Press Event, 0 to trigger Release Events
click b0,1 // Trigger Touch Press Event of component with .objname b0
click 4,0 // Trigger Touch Release Event of component with .id 4

Couple thoughts:

  • Does the Nextion screen return any error message? F.ex. 1A FF FF FF (details in the instruction set).
  • Does the component even accept such a long string? By default the max length of strings on Nextion is 10.
  • Is p[1].b[5] really the correct component?
  • You don‘t need any CR LF at the end of your string. In fact LF is not supported by Nextion; they only use CR (\r) for new lines. Don‘t ask me why they didn’t go with the standard \n I don‘t know.
  • Are your " characters escaped properly. A common mistake would be to write Serial.print("t0.txt=\"Hello World") - which misses the (escaped) " character at the end. The best would be to share the exact code line(s) used to send the command.
  • If you‘re sending a bunch of commands at the same time you may cause a buffer overflow. This would be indicated by an error message (see first point).

Hope this helps!

Yes - My " characters are set up properly. If I hard code these strings, I see it just fine.

I think your suggestion about the default length of strings in Nextion is my problem. I am now able to see my string correctly.


This forum is in no way affiliated with NEXTION®, ITEAD STUDIO®, TJC®, or anyone else really. All product names, logos, and brands are property of their respective owners. All company, product, and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement from the respective rights holder(s).