# ITEADLIB\_Nextion published on Particle Build

**URL:** <https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950>\
**Category:** Libraries\
**Created:** [December 2, 2015, 7:58am UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950 "2015-12-02T07:58:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [December 1, 2015, 7:42pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/1 "2015-12-01T19:42:45Z")

</div>

I’ve just pushed a (work-in-progress) port of the `ITEADLIB_Arduino_Nextion` library to Particle Build (aka Web IDE) which was originally started by @Bspranger who kindly granted me the privilege to adapt it for Particle Build.

I dropped the `Arduino` in `ITEADLIB_Arduino_Nextion` tho’ 😉

So it’s now `ITEADLIB_Nextion` on Particle Build - the demos now all build, but I haven’t acutally tested them on the displays.

_Edit: For the time being the lib does contain some blocking loops that don’t work well with the cloud housekeeping, so you might need to go non-cloud-bound or use the `SYSTEM_THREAD(ENABLED)` (beta) feature._

---

<div class="post-metadata">

**Author:** ![RWB](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rwb/32/22599_2.png) [@RWB](https://community.particle.io/u/RWB)\
**Post date:** [December 1, 2015, 8:14pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/2 "2015-12-01T20:14:50Z")

</div>

I have a 5 inch Nextion display sitting here that I have not had time to play with yet but it looks nice and I’m happy the code for it and the photon are now in the library. Thanks for that 😄

---

<div class="post-metadata">

**Author:** ![Bspranger](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bspranger/32/5725_2.png) [@Bspranger](https://community.particle.io/u/Bspranger)\
**Post date:** [December 1, 2015, 11:08pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/3 "2015-12-01T23:08:29Z")

</div>

When I get back to the nextion I will be sure to start from this fork. There is much that can be done to make it better/more complete.

---

<div class="post-metadata">

**Author:** ![xcode](https://avatars.discourse-cdn.com/v4/letter/x/6a8cbe/32.png) [@xcode](https://community.particle.io/u/xcode)\
**Post date:** [December 2, 2015, 6:21am UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/4 "2015-12-02T06:21:56Z")

</div>

This is great! Thanks @ScruffR. I was adding files manually as I played with this display and the tabs in the Web IDE soon became unreadable…

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [December 2, 2015, 7:56am UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/5 "2015-12-02T07:56:48Z")

</div>

Welcome!  
I just realized one “minor” issure of the current version: At the moment there are several places in the library that do have blocking loops, which does not work well with the cloud connection.  
So for the time being you might have to go non-cloud-bound or use `SYSTEM_THREAD(ENABLED)` in the demos and your own code till I get round to adding `Particle.process()` wherever needed or someone files a PR for this 😉

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [December 2, 2015, 8:56am UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/6 "2015-12-02T08:56:52Z")

</div>

OK, I’ve added some `Particle.process()` lines and republished 😉

But now I seem to have not serial communication between the my display and the Particle.  
Can anybody test this too, please?

_Edit: Found the cause. The original lib seems to fail to call `Serial1.begin()`_

---

<div class="post-metadata">

**Author:** ![xcode](https://avatars.discourse-cdn.com/v4/letter/x/6a8cbe/32.png) [@xcode](https://community.particle.io/u/xcode)\
**Post date:** [December 2, 2015, 2:05pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/7 "2015-12-02T14:05:33Z")

</div>

I can’t find this in the Libraries. I’ve refreshed my browser and clicked the refresh Libraries button.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [December 2, 2015, 2:19pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/8 "2015-12-02T14:19:40Z")

</div>

Is it possible you looked for it about half an hour ago?  
Due to above errors I’ve pulled it off again, corrected the errors found and then republished it.

If it’s less than half an hour ago, you might have to

1. got to the Particle Build settings (gear symbol), press CLEAR CACHE
2. close Build and best your browser too
3. reopen Build
4. REFRESH LIBRARIES

then you should be able to find it.

---

<div class="post-metadata">

**Author:** ![xcode](https://avatars.discourse-cdn.com/v4/letter/x/6a8cbe/32.png) [@xcode](https://community.particle.io/u/xcode)\
**Post date:** [December 2, 2015, 2:26pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/9 "2015-12-02T14:26:04Z")

</div>

Clearing the cache then refreshing the libraries worked, Thanks! 😄

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [December 2, 2015, 2:33pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/10 "2015-12-02T14:33:58Z")

</div>

I’ve still seen some occasional blocking (with subsequent cloud drop) when the serial communication to the display is bad.  
But I’ve not got the time to dig into it any deeper for the rest of the week.

---

<div class="post-metadata">

**Author:** ![xcode](https://avatars.discourse-cdn.com/v4/letter/x/6a8cbe/32.png) [@xcode](https://community.particle.io/u/xcode)\
**Post date:** [December 2, 2015, 2:45pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/11 "2015-12-02T14:45:27Z")

</div>

I didn’t notice any blocking issues, but I also didn’t have all the files included in my project yet. I’m going to create a new project and give your library a try. Were you able to load any of the example HMI files from the example folder on iteads git hub? I get some error about the resource file being corrupt.

My C skills are very bad, been a C# coder and very spoiled with the debugger in Visual Studio. But I’m willing to test it out and help if I can 😄

---

<div class="post-metadata">

**Author:** ![RWB](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rwb/32/22599_2.png) [@RWB](https://community.particle.io/u/RWB)\
**Post date:** [December 2, 2015, 2:59pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/12 "2015-12-02T14:59:20Z")

</div>

@xcode post some feedback on how setting the screen up goes with this library if possible. I’m going to try to make a custom screen for the Nextion screen also but haven’t used the software yet although I did take a quick look at it.

I’m still not sure how the coding between the Photon and the screen works considering the Nextion software creates it’s own custom code. I didn’t find any good tutorials on how to this works, just some quick videos showing somebody flying through creating an example.

---

<div class="post-metadata">

**Author:** ![xcode](https://avatars.discourse-cdn.com/v4/letter/x/6a8cbe/32.png) [@xcode](https://community.particle.io/u/xcode)\
**Post date:** [December 2, 2015, 3:04pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/13 "2015-12-02T15:04:22Z")

</div>

@RWB Sure thing. Have to head off to work now, but when I get back to this I’ll post my feedback. My first project with this screen was very simple but it was working 😄

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [December 2, 2015, 3:04pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/14 "2015-12-02T15:04:58Z")

</div>

> [@xcode](#):
>
> Were you able to load any of the example HMI files from the example folder on iteads git hub?

Yes, I've tried `CompTimer` and `CompWaveform`.  
Have you got the most current version of NextionEditor (0.31) installed?

---

<div class="post-metadata">

**Author:** ![xcode](https://avatars.discourse-cdn.com/v4/letter/x/6a8cbe/32.png) [@xcode](https://community.particle.io/u/xcode)\
**Post date:** [December 2, 2015, 3:10pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/15 "2015-12-02T15:10:14Z")

</div>

@ScruffR I got the current version (0.31) and just downloaded that same example and got the same error about the resource file. Maybe it’s my install that is bad. I’ll try the uninstalling/install method and see if that helps. At least I know the files are working. Thanks.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [December 2, 2015, 3:14pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/16 "2015-12-02T15:14:46Z")

</div>

I think there was an error report on their forum which I replied to.  
As far ad I remember it has got something to do with some write protected file, which you just need to delete.

I’ll try to dig the post up.

It’s not exactly the same thing, but you might still try to remove `ca.ca` from the program folder  
[http://support.iteadstudio.com/support/discussions/topics/1000057805](http://support.iteadstudio.com/support/discussions/topics/1000057805)

You could post the error message or a screenshot here and on the ITEAD support site.

---

<div class="post-metadata">

**Author:** ![dwfick](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dwfick/32/3259_2.png) [@dwfick](https://community.particle.io/u/dwfick)\
**Post date:** [December 2, 2015, 11:39pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/17 "2015-12-02T23:39:34Z")

</div>

I ported the NEXTION Arduino sources to run on a Photon about a couple of months ago. Right off I noticed the call to `nexLoop()` never returned, So I removed the `while (true)` in `NexTouch::mainEventLoop()` and just call `nexLoop()` from the Photon’s main loop.  
Next, I noticed that `NexTouch::recvRetCommandFinished()` always timed out when there was no error - in this case the display returns nothing. So I shortened that function’s timeout and assume pass when nothing is received.  
Otherwise it all works!

Edit: Looks like the NEXTION Arduino sources were majorly updated since I last ported them, and the structure of `nexLoop()` has changed so that it now returns. Okayfine.

---

<div class="post-metadata">

**Author:** ![Ali](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@Ali](https://community.particle.io/u/Ali)\
**Post date:** [December 16, 2015, 9:41pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/18 "2015-12-16T21:41:16Z")

</div>

I have recently received a Nextion 4.3". Im trying to set up the touchscreen to control the relay shield. i have a small webapp that currently does this. How would i make the controls GUI based using this touchscreen.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [December 16, 2015, 10:04pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/19 "2015-12-16T22:04:50Z")

</div>

You’d need to give some more details about your intentions.

But before that you should actually get your hands on the Nextion Editor and look at the demo HMI files provided with the library (via the GitHub link) and dig your teeth into the demo INOs.

---

<div class="post-metadata">

**Author:** ![Ali](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@Ali](https://community.particle.io/u/Ali)\
**Post date:** [December 16, 2015, 10:30pm UTC](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950/20 "2015-12-16T22:30:17Z")

</div>

Doing that right now.

[Next page](https://community.particle.io/t/iteadlib-nextion-published-on-particle-build/17950.md?page=2)
