Start a new topic

User code on Nextion basic model


Is it possible to use the user code part of the Nextion editor for basic model display ?

For example I have a simple number value and 2 buttons, to increase and decrease the value.

Using the Arduino through the serial at 9600 bauds is very time consuming for simply increasing or decreasing the value on each pop event.

Instead I'm thinking of using the user code to modify the number directly on the display and simply get the value from the arduino sketch at low interval without having to deal with the events on the display.

Is it possible? Every example I found on the website is using the arduino sketch, no user code example.

Thank you. 

"user code" is the magic term ... aren't you the user? So, just code it ... all Nextion commands are well documented ...

In general it is surely doable, but more like by doing and not by searching for others code ... :-)

I'm a user right, but I must be stupid because I really dont understand how to code it.

Which kind of syntax do I have to use? I guess it's not Arduino code or C like as there is no ; at the end of lines.

Can I define variable? the documentation didn't mention anything about it. 

I've see the documentation about the commands, but without any example it's not easy for a simple user which is not a professionnal coder.

For example I can't find any command to set a value, only to get ones from the objects.

I dont want to copy code, only to find the minimum information to start.

Well the minimum information to start, is from Nextion Editor Help under Help

- Datasheets

- Nextion Editor Quick Start Guide

- Nextion Instruction Set

- Reading Forum Posts

Reset your expectations - it is not a coding language per se

it is more a list of available commands.

Defining Variables:

  Add a Variable component to your page from Nextion Editor

  - set .sta attribute to string or leave as numeric.

Setting an attribute (only green attributes can be set at runtime)


syntax is mostly


expressions are not complex

  meaning no order of operation

  no compounding statements for compares

Do look at some coded examples to get a feel for it

  I have a few fully coded Nextion Side Examples in this thread

  - Yahtzee, Mastermind, Piano, and TiltBox

Then you will see that with some basic commands - much can be done

Thank you Patrick, your examples is exactly what I need to start :)

It's not so easy to find on the forum, doing Nextion side tasks is a great advantage you should push those examples in front.

Thanks for the explanation, nowhere is written that it's more a command line interface than a coding area. I guess it's important for beginner to know it.

Tools Tips Tricks and HowTOs, Arduino Nextion Examples, Nextion FAQs

are pinned in the top 5 threads when you do a Nextion overview

Just a few points.  Its A ... but its Not a language, and its Not a CLI.

It is just easier to get a grasp when you have a different outlook.

It started from a few base commands and evolves from there.

I have created a Nextion Side EEPROM Editor, so its Not a CLI


Its sequential processing with few interrupts, not multithreaded

Its record structures, not objects Touch press, touch release, a few rough timers

- you do have "coding areas" sort of - sequentially

So with some thought, a bit of crafty arrangement

... much can be accomplished with the Nextion Instruction Set.

You posted at Feb. 11.  "Nextion and 1wire library issue ?"
"After doing examples and tests screens successfully ..."

And today you state ...
"I've see the documentation about the commands, but without any example it's not easy for a simple user which is not a professionnal coder ..."

You like to troll us a bit????


It's two completely different problem.

On the first topic I tried to use an arduino with your library, and it works with the examples provided with the library.

This topic is about the user code which is all different from the arduino side, the documentation is just a list of command, not an explanation of how to use them.

With "nextion user code" on google the only relevant replies is the Nextion instruction set and the Nextion editor quick start guide. Nowhere in these two pages there is a simple example of a user code. The HowTo from Patrick is perfect and helped me a lot but it's not referenced as user code, which is the official name in the Nextion editor.

So I'm simply suggesting you to help people to find the information. Patrick do a great job with the howto, its a pity we can't find them more easily.

every HMI is user code ... isn't it ... you only need to load the HMI into the editor and just watch and analyze the code ...

and there are plenty of posted HMI's out in the forum ... for this we have e.g. a Gallery ...

HMI's are sources !!! Do we really need to mark them extra ???


Login or Signup to post a comment