Start a new topic

send component ID

 Guys, i just need a simple YES or NO

When you put a check mark to a button and ask to send component ID, the line i see on the simulator goes out to Nextion serial port and i can read it on my MCU ?

Yes or No ?

Next week i get a FTDI USB to TTL cable and i could monitor on the PC, but i do not have it now. Sorry.

Thank you

New question?

As you already have seen 

  check box in Send Component ID sends 7 byte

  0x65 0xAA 0xBB 0xCC 0xFF 0xFF 0xFF

  0xAA byte contains Page Number of component

  0xBB byte contains components .id attribute

  0xCC byte contains 0x01 for Press 0x00 for release

This you already posted screen shot of 0x65 Return Data Section

  of the Nextion Instuction Set.

So every canvas component has both Press Event and Release Event

  - every Press Event and Release Event has a corresponding

      checkbox for Send Component ID

  - simple test in Debug to review results

But this was already established  in prior thread.  No?

Does mikroC for PIC have both UART and Software Serial lib?

   - mikroPascal for ARM does have, should PIC be different?

So such has libraries have both write and read functions ?

What the Nextion Debug simulator shows (serial wise) is accurate

Nextion sends it - it is on the wire

 - it is up to you to capture by MCU and choose to react to it

So is the question rhetorical ? 

  Is there reason to doubt the return data?

[Typos corrected]


Can I read it on my MCU?

 - this question (send/receive) is covered in 100+ threads

   - suggesting MCU side read/write by MCU side code

     is a difficult task for some.

Nextion comes with a set of training wheels of sorts.

  - the system variable bkcmd (default 2) sets level of debug.

    see Nextion Instruction Set

  - most Nextion transmissions is sent with trailing 0xFF (frame end)

so until such frame ends, it remains only part of current frame

frames are fully describe in Nextion Return Data

So reading by MCU should be straight forward, seemingly

   - yet many implement in a manner that causes grief.

   - the bkcmd variable is there for a purpose, to demystify.

Thank you Patrick.
I do not have an issue to capture any incoming data.
But at the moment, i did not have connected any MCU to Nextion Display.
I just design the display first on my PC.
When i am happy, i will connect an MCU.
And during the design i mark down (on a paper) sent data, to use it later on the MCU when captured.
I use Nextion only for Display data, like temperature sensors and humidity, and for selection of operation mode.
For fan speed i can select 3 speeds or stop just from Nextion display.
Each button for selection will write a value to a variable, like 2,4,8 , the data is printh to my MCU and i know what to do.
I was just curious if the return string display in the little windows goes to serial port out or not.
Thank you for answer, and keep in mind that "I do not have an MCU connected yet".


@ to Patrick
Attached is a short list to links to read which will help me on making my project live :)
Each link has a short answer to one of the action i want to implement.
Save some space on Chat forum and do not ask.


(91.7 KB)

Print and printh are two commands that send frameless data.

The get command is the framed data equivalent

As told earlier,

    Mixing of framed and frameless - will involve more code

    - many conflicts can result from such mixing

    But Nextion indeed contains flexibility of choice

Nextion does not however contain a means for making

    frameless its Return Data

Hope this is helpful

Thank you Patrick but i cannot use GET
I do not know when the user press a button (or maybe just after i get that $65 ...$ff $ff $ff).
Of course after "send id..." i can use GET.
My idea was to : after i press button HI, when my variable become $8, to send out using printh
06 variable number $8 $ff $ff $ff
That will tell me that i have a pack of 6 hex numbers coming starting with 0=06 and 05 = FF.
Also the last 3 FF will tell me the transmission is ended.
The byte 1 and 2 are the one i have to use in my program, and discard the rest.
But , when i will use a PC cable to monitor the communication, i can do more changes.
At the moment is just floating in the air or my head.

inside any event (press/release)

   get rtc3 // system variable numeric value 0x71

   get n0.bco // numeric attribute 0x71

   get va0.txt // string attribute 0x70

get command can certainly be strategically placed.

While you can indeed change (by choice) the structured format

I would argue for capturing the other framed return data.

 - Nextion reset/ready

 - command success/failure with cause

 - auto sleep / auto wake, etc

Path of ignoring what nextion sends leads to

 - arbitrary timings and use of delays

 - read before data sent and ready

 - missed data - data after timeout


One path is fully informative and all is straight sequential

The other path is less informative, blind and assumes.

But certainly you do have choice.

Thank you Patrick.
I will keep in mind your suggestions.
But first let me connect it to an MCU, then i will update you on real life.
I was against of GET because like i said, my MCU, does not see the user finger on the screen and does not know when to send get.
But like i said.
Let me first see whats happen on my PC, then i can have an educated answer.


I got the cable, i am using Comm Operator and now i can see what is going out, i can send data out, or control the HMI by sending data to it from PC(to be replaced with an MCU later).
I put a push button to print $03 $FF $FF $FF just for test and it works.
I love the product now.
Where i can find example using the external GPIO. I want to use them just as an input.
Also, if i want to use the external GPIO, what type of cable and were to buy it to attach the external GPIO to the CPU mother board.
Thank you for help.


first log.png
(3.59 KB)

1) 0x03 0xFF 0xFF 0xFF  - Page ID invalid

    - Nextion Instruction Set - Sec 6 Return Data Table 1

2) Tutorials Tiltbox and Piano use GPIO

    - Nextion Instruction Set, cfgpio


3) GPIO uses an FPC 10-pin 1.0mm

    - for 

       Expansion Board for Nextion Enhanced Display I/O Extended

          Model: IM160530001

       Nextion IO Adapter

          Model: IM161123001

    or create custom as needed

0x03 0xFF 0xFF 0xFF this is not the page ID.
I disabled the page ID as i do not need it for my CPU.
03 it is a custom command to signal the CPU that i selected for my FAN the Medium speed.
I can use the button ID also, but my program which works flawless for almost 6 month is structured on some values for fan speed , mode, and so on.
In fact i added a 46 (ascii "F") before the speed so i will now that the data is for fan speed.
I have lots of fan with it.
But this of course does not stop me to put questions when i am stuck.
Thank you for answers.
I have the expansion board, but i am looking in the future to buy just the cable and connector and put it on my CPU board.


You missed what I told before

 - Nextion already has a 0x03 0xFF 0xFF 0xFF

now a double definition of return codes can indeed cause issues ..

Anyhow, cables, and trays

  - parts distributor or ebay

Thank you. In did i miss it as english is my second language. Maybe i will send before the full "F" "A" "N" in ascii and avoid future confusions.
I got it now.
Probably i can get ITEAD to make my CPU board and they will know what connector to put , and they have it in stock.
I made before boards with ITEAD and i was happy.


Login or Signup to post a comment