How to go from one page to another in Nextion using a rotary switch ?

Hello firashelou,

You read the rotary switch and use it to determine which page you want. I suggest you maintain a global variable something like:

uint8_t page;

Which holds the page the Nextion is on.
To tell the Nextion to change page you can use something like:

  Serial.print ("page");
  Serial.print (page);
  Serial.write(0xff);
  Serial.write(0xff);
  Serial.write(0xff);

Note I put that together in a hurry and have not tested it, apologies if it is not quite right.