Rushtp #101.1 - Nextion Notes - Demonstration of Local Vs Global Attribute Variables
by Rushtp in Circuits > Microcontrollers
25 Views, 0 Favorites, 0 Comments
Rushtp #101.1 - Nextion Notes - Demonstration of Local Vs Global Attribute Variables


Background
Before we get into programming in Nextion Editor it is important to understand
how Local and Global settings affect the values of object variables when displayed pages
are changed or refreshed. So let’s set up a quick demonstration…
For the Nextion display case build: Rushtp #1 - Nextion 7” Display DIY Enclosure/Case : 12 Steps (with Pictures)
Supplies
- Nextion Editor (Download)
- Nextion Editor Guide
- Nextion Instruction set
Nextion Editor - Objects and Coding


Create a new project "Demonstration of Local vs Global Attribute Variables.HMI" and add the following objects with the attributes and code listed below.
Running in Debug tap the Nr ++ button. Both the Local and Global values will increment by 1.
Now tap the Refresh page 0 button.
- The Local value will return to its default state (the one set by Attribute val = 0).
- The Global value will not change and will continue to be incremented when the Nr ++ button is tapped.
This is important because it ensures object values are retained when a display page is changed or refreshed. Without the Global setting object values would revert to their default values.
Note: The objects with yellow tags (n0) have a vscope set to local, while black tagged (n1) vscope are global.
|
|
|
| Note: object n1 has it’s vscope set to global…
|
|