Start a new topic
Not Taken

commands via RS232

Hi,
can I send, only with this display, some digital commands trough rxd txd ?

For example if I make a button ON, when i press him, this send via rs232

$18 $00
and for OFF button
 $18 $01

  thank you in advance !


I will refer you to the Nextion Instruction Set printh


printh FE FE E0 40 1C 00 01 FD


would be the correct format in your button event section.  As per the instruction set remarks #1 "not shown in the simulator", actually will show in the simulator.   #3 one space between parameters. (your example posted above is using two spaces between printh and data).


Again, I hope this was helpful, if not please describe - more details do indeed help.




2 people like this

I am now reviewing all of the Feature Requests, this will take some time, patience please.

Although this wasn't a real feature request, it is now marked as reviewed.

Future questions should be posted to the Free Chat Section


1 person likes this

There are a few things you might try depending on what the equipment is looking for.  If the command should be accepted with one press and it is taking three, you might try a baud rate one step lower.  Other things to try is if your 8 bytes of hex can be input through more than one command cycle (ie 4 bytes sleep 50ms 4 bytes).  Also if equipment is sending return data to the display, the rx may need to be cleared from time to time.  The display is TTL and may need special attention to rx/tx if the equipment side is expecting UART/USART.  I believe the hardware buffer is 12 bytes on the MCU and not sure if the sending interrupt is being displaced by the receiving interrupt (or vice versa).  Good to see progress, enjoy.



1 person likes this

I am not sure what you are referring to.


If you have a dual-state button in the Nextion HMI and you press the dual-state button on the Nextion:

The Nextion can already send this information over rx/tx.


In your hmi project, select your dual-state button, then in either the press event or the release event, check the "Send Component ID" checkbox. 

The format returned will be in 0X65 0X00 0X02 0X01 0XFF 0XFF 0XFF where:

65 indicates touch even data being returned

00 where this is Page 0

02 where this is component ID #2

01 where the component has been pressed,  00 has been released

FF FF FF indicating the end of data marker

With is information you can now have other logic on the other end of rx/tx to respond.


If you want to have the dual-state button show on the Nextion as in a pressed or not pressed from the other side of the rx/tx, the Nextion can already accept this over rx/tx

In your logic on the other side of rx/tx send the following text string to the Nextion Display

bt0.val=1

will turn the dual-state button named bt0 to the on state

bt0.val=0

will turn the dual-state button named bt0 to the off state

you can also check from the other side of the rx/tx to find out what state the dual-state button is in on the Nextion display by sending the following command

get bt0.val


You can find out more in the Nextion Instruction Set section of the forum here


Hope this was helpful, if not, please describe



1 person likes this

 Thank you again, Patrick,

  in the meantime i made it, exactly as you tell me now.

almost is OK, equipment take the command, but I need to press  for three times the button

Maybe is something about level, I need to try.

Anyway, I'm happy for the first step :)

  my best regards!

 Thank you for reply,

 but is not what I need..
 I have one equipment, who is controlled via pc with software on RXD/TXD data line

with Nextion  I hope  to eliminate pc and software and send that RS232 commands with one touch on display. commands look like this :
 FE FE E0 40 1C 00 01 FD
 With editor, on button event and on user code, I write:


printh  FE FE E0 40 1C 00 01 FD

 but not working.

also I try with


printh  hex FE FE E0 40 1C 00 01 FD

Maybe it is another commands to send this, on TX line of display to the equipment ?


Login or Signup to post a comment