Start a new topic

Different outputs for the same command


Ich have the problem that i have two buttons.

The command of the first button is: print "heat"

The command of the second button is : print "cool"

If i now use nextion.listen() i get for the first: a combination of Nummbers

and for the second i get : "cool" as expected?

Are there any other ways to send serial commands?

Greetings Tobias 

Which library Tobias?

print "heat"  - nextion device sends out 68 65 61 74 ... the letters of heat

print "cool"  - nextion device sends out 63 6f 6f 6c ... the letters of cool

This you can confirm in the Nextion Editor Debug simulator.

Yeah but why does it on time send me : 68 65 61 74 

But for cool i get : "cool"

One time i get it as text the other time as numbers?

Which library?

Maybe an Error in the Libary?

Ah you break my heart, Tobias.  =)

You be foolin around with another lib and want me to advice how to make her purr.

The library you are using is one year since they made an update,

you miss out on a lot of good things.  But many people use it.

The Nextion Instruction Set is

The Iteadlib Arduino Nextion Library is

Now if I remember that library, it is expecting to catch nextion messages with

something like if (message == " 65 03 01 04 ffff ffff ffff") { }

- which to me is incorrect as Nextion trails with three bytes of FF FF FF.

However it is trying to catch messages, you need to dig in deep to discover.

Now, in IteadLib you could use the button press or release event

  and have your code button.getText();

But normally all commands in and all return codes out are 0xFF 0xFF 0xFF terminated

When you start using print and printh, it is a bit more advanced and custom,

but it also would mean you have full control on your serial input and output.

As you asked about this, you may find it easier to use the Iteadlib.

 - the authors of that library do not maintain it, nor have I heard of them

   answering support questions - so they leave you hanging unless you are

   good enough to modify it to suit your needs.

It maybe possible to try and catch your cool and heat with

  if (message == 68 65 61 74) {  ...  }

  if (message == 63 6f 6f 6c) { ... }

but I am not sure if that is enough or if they expect it terminated


It will be because of your first char 0x68

Which gets treated as a special 'case' in that library thus.....

line 254


case 'h'://0x68
	cmd = String(cmd[2], DEC) + "," + String(cmd[4], DEC) +","+ String(cmd[5], DEC);
	cmd = "68 " + cmd;	
	return cmd;


Login or Signup to post a comment