Start a new topic

Get text from nextion into arduino variable

Hi All,

I am trying get text from nextion into arduino variable but its not working I tried the following:

  memset(buffer, 0, sizeof(buffer)); //

  b211.getText(buffer, sizeof(buffer)); //


and it only works if i set text manually using tState2.setText("Example"); and call the above again

I have also tried this arduino code but same problem:

 char text_char[4];

 tState2.getText(text_char, 4);


All I get is empty output in serial monitor expect if i manually do  tState2.setText("example"); . I dont want this i want to get the text from live nextion screen. I have been stuck for a week on this :

Any help would be apprecited

No one to offer help?

1 person likes this

Hi Riad.

i'm also having the same exact problem.

did you solve it?

1 person likes this

The second part of your post actually works for me. Make sure you declare the NexText right.
Mine is like this:

NexText Text1= NexText(4, 9, "at3"); 

So Page ID, object ID, and a UNIQUE name, so not t3 if you have multiple t3's on different pages.

Login or Signup to post a comment