Unofficial Nextion/TJC User Forum

Problems running pages after pages in the Arduino sketch

Hello guys, I’m Natanael Prado. And I’m having a poblem running some pages that I made with the nextion editor in the arduino sketch. I’m trying to run some pages in the arduino sketch to create somr animation to my nextion display, each page has a time to appear that i putted in the nextion editor, but when I try to run this pages in the nextion display through Arduino, a blank image appear between each page and the animation doesn’t run the way I want, it only happens when I try to run pages. I will put a gif here

#include <SoftwareSerial.h> //Include the library
SoftwareSerial mySerial(17, 16); // RX, TX

void bomdiacriador();

void setup() {
Serial.begin(57600); //open the serial port
while (!Serial) { // wait for serial port to connect. Needed for native USB port only
;
}
Serial.println(“Serial On”); //Print this messages when the serial port is connected
mySerial.begin(9600); // set the data rate for the SoftwareSerial port
}
void loop () {

bomdiacriador();

}

void bomdiacriador() {

mySerial.print(“page 0”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 1”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 2”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 3”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 4”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 5”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 0”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 1”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 6”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 3”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 4”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 5”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 7”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 8”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 9”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 10”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 11”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 12”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 13”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 14”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 15”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 16”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 17”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
mySerial.print(“page 18”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
}

That’s the code that I made in Arduino, Anyone knows how I can solve this??

Can someone help me with this problem? plz!!! :fearful: :cold_sweat:

Have you tried putting a small delay between each page?

mySerial.print(“page 0”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
pause(10);
mySerial.print(“page 1”);
mySerial.write(0xff); //Send this three lines after each command sent to the nextion display.
mySerial.write(0xff);
mySerial.write(0xff);
pause(10);

etc

I can not use delay, because I want to do multitasking in the arduino, if I use delay the entire arduino stops, So I putted a timer in each page in the Nextion Editor, but even so I tried to put delay and the white splash screen continues to appear :confused:

At the beginning I wanted to do the animation in the Nextion editor and then upload to the nextion display through the micro SD card, but I’ve added in the program 5000 images my archieve is 1,5 GB, but the memory of my Nextion display is only 32 MB the majority of this images are repeted, So I’m looking for a way to just organize the images in the nextion editor program and chosse the image I want in that part of the animation

Don’t animate the pages, but animate the picture like this:

Yes, I saw this video and followed this tutorial, but I can’t add the image in sequence in the Nextion Editor because I have to many images and the size of my project if I do that is 1,5 GB, Is it possible to just add some images not in sequence and then organize the position of the image in the animation in each page? Like page 24 after 5, and so on… ?

Hello, so I solved my problem, I used a lot of variables in the Nextion Editor, :upside_down_face:

1 Like

This forum is in no way affiliated with NEXTION®, ITEAD STUDIO®, TJC®, or anyone else really. All product names, logos, and brands are property of their respective owners. All company, product, and service names used in this website are for identification purposes only. Use of these names, logos, and brands does not imply endorsement from the respective rights holder(s).