Go Down

Topic: Using Nextion displays with Arduino (Read 7061 times) previous topic - next topic


Got a bit 'side tracked' in the endless world of coding... especially as a newbie, sometimes it can be quite humbling and overwhelming looking at all those doors opening up in front of one's continuously growing eyes...

In a severe fit of megalomania I tried to write, well, re-write the NexNumber lib to a NexFloat and ended up in a very deep rabbit hole. took me a while to find my way out again, but got it from an endless list of errors down to a couple... and slowly a slightly broader spectrum of to this never ending subject.

But it 's definitely my turn to pass the flowers to you, Perry, for the help you are providing here. Nice little hints you are passing on, especially the last ones I found quite interesting, since it sort of unlocked a whole lot of new possibilities and you deserve every bit of Karma you can get for things like that...

Was using the Nex's own libraries and was a bit too lacy to re-write all the work I finished so fart, with your sample code in your first postings (nicely done, by the way). But I came to the conclusion, well better rephrase that, I was lucky enough to get my fit under control... ;), and now I'm humbly going to use your code and hope I can get back to you, in case I don't get it straight...but all in all work is progressing, even if it isn't 'quite' as fast as I first thought it might happen...but I find if always very satisfying if things slowly start to do the things they should.

Knowing now that I'm at least capable of asking reasonable intelligent questions, I'm glad I found somebody who is helpful  enough to answer them. Thanks a lot for that. Hope I won't have to bother you too much.

I presume that other people on the 'big search' are passing by here as well, so I thought I might pass on a little helper to the Serial.print subject, simple enough that even I could have thought of it... :D, well, I didn't...but going to pass it on anyway, since it safes time and memory...

Code: [Select]

void nexDataSend() {
  Serial2.write(0xff);       // We always have to send this three lines after each command sent to the nextion display.
  Serial2.write(0xff);       //use the Serial(x) you are communicating with your Nex

...and I find it quite handy, maybe it helps someone else as well.

will try my best to surface once in a while and pop by... ;)

kind regards


Thank you Orion, that makes helping you and others worthwhile :)


I have added to part 4 'Nextion additional features', which brings several different things together in one place. Enjoy!


@PerryBebbington et. all.  I posted this in another section but not sure it will get attention there.

I have not yet been successful in understanding the communication from the Nextion.  I have a few pages that are set up and I only need to capture the string that is sent when pages changes.  from this I will create a CASE statement and execute accordingly . 

For instance, when I am viewing the debug, and I am moving from page0 to page1, I get an simulator output (I am assuming I will see this as a serial string?) of  "65 00 02 01 FF FF FF"
So I have recorded all of these strings associated with the page movements and created a table of string, pulse and direction.  This will not be a high frequency event. (it is a shifter for a car)

Can I just use a simple serial program to read the string and then act upon the string in a CASE Statement? 
Thank you for any assistance you may be able to render.  I have some pictures but dont know how to or if I can post them


Hello altitudeap,
Sorry for the late reply, I have been on holiday :)

For instance, when I am viewing the debug, and I am moving from page0 to page1, I get an simulator output (I am assuming I will see this as a serial string?) of  "65 00 02 01 FF FF FF"
Yes, what you see in the simulator window is what is sent to the Nextion serial port. I would hesitate to call it a 'string' as that words has specific meaning in the C and C++ languages, and I don't think this data qualifies. Those bytes, as shown in the simulator window, will be send to the serial port.

It is clear from the rest of your question that you have not tried my examples as set out in this tutorial, the answers are in there. Try the examples, then come back when you need further explanation.

Go Up