Hi,
Im using a UNO , Nextion display plus the "Nextion.h" library.
I have two pages set up page 0 and page 1:
//declare pages:
NexPage Calpage =NexPage(1,1,"Page 1");
NexPage Mainpage=NexPage(0,0,"Page 0");
The display works fine and I can switch between these pages in the Itead IDE simulator attached to the board via the serial link.
I can also change numbers etc on both pages from Arduino code and from the simulator.
The problem is I can find the commands/syntax for changing the displayed page from my Arduino sketch, anyone help ????.
( I had thought it was just "Calpage.show();" but this doesn't do anything !
my play code:
/*
Paul Hammond
Nextion display test uses "eec corner wt 2.tft"
just to record the commands of interest and how they work
*/
#include "Nextion.h"
// LED pins
const int led1 = 13;
int X = 255;
int Y = 321;
int noloops = 0;
// Declare Nextion objects - Example: (page id = 0, component id = 1, component name = "b0")
//calibration page:
NexButton LF = NexButton(1, 0, "r0");
NexButton RF = NexButton(1, 1, "r1");
NexButton LR = NexButton(1, 2, "r2");
NexButton RR = NexButton(1, 3, "r3");
NexText Wt = NexText(1, 4, "t4");
//Main page:
NexNumber LFwt = NexNumber(0, 0, "n0");
NexNumber RFwt = NexNumber(0, 0, "n1");
NexNumber LRwt = NexNumber(0, 0, "n2");
NexNumber RRwt = NexNumber(0, 0, "n3");
//declare pages:
NexPage Calpage = NexPage(1, 1, "Page 1");
NexPage Mainpage = NexPage(0, 0, "Page 0");
void setup()
{
nexSerial.begin(9600);//coms to LCD
nexInit;
pinMode (led1, OUTPUT);
}
void loop()
{
digitalWrite(led1, HIGH);
delay(1000);
// Mainpage.show();
RFwt.setValue(Y);
LFwt.setValue(999);
RRwt.setValue(456);
LRwt.setValue(noloops);
digitalWrite(led1, LOW);
delay(1000);
RFwt.setValue(X);
RRwt.setValue(654);
LFwt.setValue(000);
LRwt.setValue(noloops);
noloops++;
if ( noloops == 10) // change the page viewed
{
// move to display"1"
delay(3000);
//and back...
noloops = 0;
}
}