Anyone got experience with >4 inch displays?

@LukeUSMC, I haven’t had a chance to play with the Nextions at that level yet but there are examples available. Check the forum and the wiki.

It’s really easy to use and you can test everything from the Nextion Editor before you purchase. Even the refresh delay is emulated correctly!

Here’s my efforts so far…

2 Likes

That’s awesome. I may rip off your UI design a bit if you don’t mind. Where did you get the graphics or did you make them yourself?

Yeah feel free. I “found” the weather icons and the rest was designed in PowerPoint :smile: Font is Ubuntu Mono.

Are you using the new Arduino libs? I made the changes @peekay123 said were needed to port but they have broken everything out and I am getting a “utoa was not defined in this scope” utoa is being called in several of the “minor” libs like NexCrop.h.

@JumpMaster, any chance you can share the HMI file? That bar graph is very cool and I really like your fonts!

I have ported the latest Arduino lib to Spark if anyone needs it.

2 Likes

I’m only using 3 Nextion commands so didn’t want to import the whole library. I’ll zip the images, fonts, and HMI file later and post a link.

void nextionExecute() {
    Serial1.write(0xFF);
    Serial1.write(0xFF);
    Serial1.write(0xFF);
}

void setPic(const int page, const char* name, const int pic) {
  char buffer[100];
  sprintf(buffer, "page%d.%s.pic=%d", page, name, pic);
  Serial1.write(buffer);
  nextionExecute();
}

void setText(const int page, const char* name, const char* value) {
  char buffer[100];
  sprintf(buffer, "page%d.%s.txt=\"%s\"", page, name, value);
  Serial1.write(buffer);
  nextionExecute();
}

void refreshComponent(const char* name) {
    String cmd = "ref ";
    cmd += name;
    Serial1.write(cmd);
    nextionExecute();
}
2 Likes

I have been playing with the nextion a bunch and it is quite easy to use. I have been able to implement a back button, keyboard with shift and cap lock, etc. Some of these have been put on the nextion forum.

You can do a ton without any arduino code.

2 Likes

@LukeUSMC could you share with me ? I need it :)) many thanks.

Nextion Lib Port

2 Likes

@JumpMaster i liked your minimal approach and tested it out - but my text is not changing at all.

i have the 2.4’’ Display on the Photons RX/TX.

in setup() i did Serial1.begin(9600);

and i try to execute:

setText(0, "t0", "TEST!");

page 0 is the only page in my test and t0 the only object on that page.

adding refreshComponent("t0"); after that has also no effect.

am i missing something here?

Hi @smnnekho,

Try this even more basic example…

setup() {
Serial1.begin(9600);
Serial1.write(0xFF);
Serial1.write(0xFF);
Serial1.write(0xFF);
Serial1.write("t0.txt=\"test\"");
Serial1.write(0xFF);
Serial1.write(0xFF);
Serial1.write(0xFF);
}

Also make sure the TX from the display is connected to the RX pin on the Photon and RX from the display is connected to the TX pin on the photon.

Kev

2 Likes

:flushed: :flushed: :flushed: :flushed:

And there i am. Thought i would be the uberguy since it went so well with all that electronics stuff - i must be a genius. :stuck_out_tongue_closed_eyes:

well not so much, since i connected RX --> RX and TX --> TX.

Thanks for opening my eyes… it’s working fine now. Looks like i have a lot of reading and learning to do. :stuck_out_tongue_winking_eye:

1 Like

Could I bug you for the HMI again? Also what size did you set the page to in PowerPoint so it wouldn’t get cropped when you imported it? Thanks!

You can actually set the page size in px. If you type 240px it will replace it with the correct mm/inches depending on your preference.

@LukeUSMC Have you placed the ported arduino library in the Spark/Particle library - if so what is it called - I have search ed for a number of things but not found anything related. Thanks

I tried to import it but haven’t been successful as of yet. In the meantime you can click the + icon in the top right hand corner of the WebIDE and add files one by one. Given how modular this lib is that might be a bit tedious but if you only add the pieces you are using in your app then it might not be so bad. If you use nextion.h it has include statements for all the rest of the files…
Nextion Lib Port on GitHub

I have a fork on nextion’s git hub where I have extended the functionality to give you events on page changes.

I also added value events for objects like the slider. No need to get a push event then have to ask for it’s value, now you can get the event with the value.

My fork is under bspranger

I need to document a little bit. But I plan to expand the fine some more after I get the photon CAN BUS driver working.

Nice! I’ll prob just switch to yours. Thanks for sharing that.