Start a new topic

Get current value of progressbar for Text value


I want get current value of progressbar for text value. But it's not worked. See attached image and HMI-project.

(11.6 KB)
(7.41 KB)

txt is a string,  

you should convert to ”int“ by external MCU.

You may see this example

t2 is a text field on the Nextion

This will not work in Arduino:

char varText[4] = "000"; //a variable to hold the new text
itoa (numericalData, varText, 4);

 But this will work and t2.txt is changed to "50"


 The Question is how to get the char varText to send?

Actually you can do it without MCU

"cov v0.val,t0.txt,0"

4 people like this

Hello folks. 

I am very new, so sorry if this has been answered somewhere already.... I added this code to the pre-initialize part of a page, because I want the text (t1) to update with the percentage of the progress-bar (j0): 

  t1.txt get va0

 I tried many different things, but it just won't do what I want...

The instruction set I found on the Itead website isn't showing anything about variables to strings. 

Any tips will be appreciated!

Please review the Nextion Instruction Set  section 2.8 cov variable type conversion

As scruff said in the post just above your post: use the cov command

  cov j0.val,t1.txt,0

You can either do Nextion side, or send via MCU over serial

  sendCommand("cov j0.val,t1.txt,0 ");

Perhaps try some of the things suggested in the threads

 - you maybe surprised with the results.

Hey Patrick. Thanks for you reply. 

I totally missed that post... Completely overlooked it. Thanks again, it works beautifully!

And I will read forum posts, they sure are very educational!

Login or Signup to post a comment