Unofficial Nextion/TJC User Forum

How do you use a variable from the Nextion Editor tool box

I want to add a variable from the toolbox and then increment the variable by 900 every time a button is pressed, but I keep getting a compile error when I go to debug. This will be under button1 (I will convert to it to text).

If you want to do addition, the variable must be declared as numeric, not text, in the attribute pane. Then, since it is numeric, you have to take off the quotes in your if() clause.

In your example, the compiler clearly complains about the quotes around 3600.

Code would be

if(va0.val==3600)
{
  va0.val+=900
}

If you need later or elsewhere va0.val as text, you’d have to convert it into a separate text variable using the covx function.

Check out my post on using Reparse mode I explain it all there.

Thanks. I will check it out.


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).