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.
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?
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.
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
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.
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
- itead.cc for
Expansion Board for Nextion Enhanced Display I/O Extended
Nextion IO Adapter
or create custom as needed
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