I have imported a couple pictures. The are numbered 0 to 10.
Is it posible tho load a picture with a command from the Arduino.
This is my code but it not working:
/* load picture and display */
void updatePicture(int picture_nr)
Serial2.print("p0.pic=\""); // Changing the value of pic
Serial2.write(0xff); // We always have to send this three lines after each command sent to the nextion display.
Or is it posible to load a picture from the sd card. I have a 4.3" P version
Thanks for any help.
Here’s how I do it:
const char* nextionEnd = "\xFF\xFF\xFF";
const char* nextionQuoteEnd = "\x22\xFF\xFF\xFF";
const char* pageSync_b6_Char = "pageSync.b6.pco=0";
Or similar code where the id changes:
SerialPrint and SerialWrite are just wrappers around Serial.print and Serial.write which allow different serial ports to be used.
Couple tips for readability:
You can include quotes (and backslashes) in a string by preceding them with a backslash. F.ex.
Serial.print("Arduino says \"Hi\". ");
=> Arduino says "Hi".
Serial.print("Some path: C:\\Hello\\World");
=> Some path: C:\Hello\World
Additionally, if you want the ordinal of a single character (a.k.a. just one number, not an array of chars/numbers), you can use single quotes (more details):
int quotes = '"';
Serial.print("ASCII code of the character \" : ");
=> ASCII code of the character " : 34
This should be more readable than using