Nextion User Manual
For Arduino developers
CompPage.ino
How to Use
Show how to use API of class NexPage.
Author
Wu Pengfei (email:pengf.nosp@m.ei.w.nosp@m.u@ite.nosp@m.ad.c.nosp@m.c)
Date
2015/7/10
#include "Nextion.h"
NexPage page0 = NexPage(0, 0, "page0");
NexPage page1 = NexPage(1, 0, "page1");
NexPage page2 = NexPage(2, 0, "page2");
NexPage page3 = NexPage(3, 0, "page3");
NexTouch *nex_listen_list[] =
{
&page0,
&page1,
&page2,
&page3,
NULL
};
void page0PopCallback(void *ptr)
{
dbSerialPrintln("page0PopCallback");
page1.show();
}
void page1PopCallback(void *ptr)
{
dbSerialPrintln("page1PopCallback");
page2.show();
}
void page2PopCallback(void *ptr)
{
dbSerialPrintln("page2PopCallback");
page3.show();
}
void page3PopCallback(void *ptr)
{
dbSerialPrintln("page3PopCallback");
page0.show();
}
void setup(void)
{
dbSerialPrintln("setup begin");
page0.attachPop(page0PopCallback);
page1.attachPop(page1PopCallback);
page2.attachPop(page2PopCallback);
page3.attachPop(page3PopCallback);
dbSerialPrintln("setup end");
}
void loop(void)
{
nexLoop(nex_listen_list);
}