NextionPage pgButton(nex, 0, 0, "pgButton");


I have been looking at this sketch.

NextionPage pgButton(nex, 0, 1, “pgButton”);

Nixon editor created two buttons page 0, ID1, bottom name pgButton can’t figure out nex.
And pinMode(13, OUTPUT); I have with connected to a LED.
button.setText(“you pressed me”) and the right in saying it’s printed out on button.
Thanks Paul.

Nextion.txt (1.13 KB)

If you named your objects sensibly, the code would be a lot easier to understand. Why do you have a NextionPage called pgButton and a NextionButton called button?

Where do you read from the nex object?

What do the magic numbers in the Nextion object constructors mean?

The sketch is from Arduino library examples.
The only thing I have changed is that ID original one(nex,0,0,1"pgbutton").
I changed it to (nex,0,0,1"pgbutton"),(nex,0,0,2"bEbutton")

thanks paul