Start a new topic

How can I use Math function in Nextion edition

in nextion editor file CompNum , Is it posible to run number in debug mode.without MCU.  I try to add function n0.val +=1 but it is error


what is the correct function


best regards 


now i use

n0.val=n0val+1


is it correct

probably just a typo (you have missing period on second n0val)

n0.val=n0.val+1


thank for your reply


but i found other problem, if n0.val store value about number 10 and I change to next  page.All number will return to be 0. is it posible to keep and and run on number 11++ when i change to other page



That is correct observation.

Think of each page as separate.  When page changes, it actually dumps from memory to have the space to load the next page you are changing to.


There is a global setting in the .vscope attribute.  This will ONLY be for keeping in memory the value.

(.txt attribute in a text component, and .val in a number component)  It gets tricky when dealing with globals.  You can access a global when on another page by including which page it is from - page2.n0.val. 


You have to play with storing the current value before exiting a page, and retrieving it once the new pages have been loaded.  It works best if the global is a variable component without many other attributes.  So transferring n0.val to a global variable on page0 

on exiting: page0.va0.val=n0.val

and on after load n0.val=page0.va0.val


So it is possible - a bit more advanced and a bit more tricky.  Remember that each page is being dumped in order to have the space to load the next page, and you have to strategize how you get around it.


it clear and work thank

Login or Signup to post a comment