Unofficial Nextion/TJC User Forum

Global variable on serveral pages

Hello,

i try to have a global var lets say on page 0.
The status of the variable is controlled by MCU.

Lets say i am on page 1 and the MCU sends a var update for the page 0 global var.

The status does not change on page 1.

I have timer on page 1 which reads the status of page 0 var and should change something.

In debug mode it works, why does it not work on a real device?
Anybody else knows this issue?

I know, i can go to Nextion “Community” but i have the feeling that it will return a standard message like “Learn how to program” or “See the instruction set” :smiley: haha

So again short problem descritpion:
Page 0 has a global var. Number.
Display is on Page 1 which has a timer to check page0var.val to show the value
MCU change value for global var on Page 0.

Nothing happens.
In debug mode it works. if i am on page 1 and change value with the instruction page0var.val=1 it shows the status of page0 global var but not on a real device.

Hope someone can help :wink:

Thanks,
Alex

Hi, try with this example:

n1.val =p[x].b[yy].val

x = page where is your global var
yy = id of your globar var

1 Like

Hi,
the problem is not inside the HMI, in debug it works.

Problem was my var declaration in my MCU code.
Naming needs to be with pagename in Nextion var declaration (unlike other vars).

1 Like

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