Start a new topic
Not Taken

Serial port suggestion

 I really like Nextion but I'm used to send just the things I really need trough UART and I really hate sending t0.txt="something" and three FF's just to send something. It would be easier if there will be shorter commands.


Also data received from Nextion should be shorter. It would be the best if the user will have option to set what the button will send if pressed. For example if I press one button it should just send a name or ID of the button, value and CR and LF 0x05 0x01 0x0D 0x0A . That will be enough I don't need to know on which page button was pressed if it have unique ID.


Another thing I don't know is how can I send other character then standard ascii? I would like to make special keyboard and I really like idea with t0.txt=t0.txt+"X" command but how can I build string with other characters?


6 people like this idea

It would be the best if the user will have option to set what the button will send if pressed.


I have also thought about something like that, to have the possibility to send the text I want when I press a button, for instance send "temp+" when I press a button to increase temperature. With such a solution, there's no need to take care about the ID of the button, and it makes the serial message more intuitive.


One problem when using component ID's is that they change automatically in Nextion Editor when you delete another component with lower ID. Then you must also change the same ID's in the Arduino/MCU code. Same problem with page ID. 

If the button sends "temp+", nothing has to be changed in the Arduino code.


I don't know if ITEAD will be able to change FF FF FF to 0D 0A, but at least it may be possible to use 0x72 as first byte when sending a message containing an ASCII string with variable length, for instance 

0x72 + "temp+" + End.


@ITEAD

Small typo in the Nextion Wiki, it should be "byte" instead of "bit" in the table http://wiki.iteadstudio.com/Nextion_Instruction_Set :


It would be nice to just send ansi also

as an example "start",  "stop", "start1", "stop1" the arduino sketch could just look for those commands to execute instead of the current format used 


1 person likes this

To complete my previous post, one solution would be to have an additional parameter called "txt2" or "tag", then we could write "get xx.tag" in the User code to send this value to Arduino/MCU when the button is pressed. See picture:



I can also not understand that it must be sent so much data to select a botton-switch goes on or off.
3 bytes should be enough.

 1.For status

 2. switch number. (room for 255 bottons)

 3 switch on or off.

I intend to use Nextion to midi systemand .Midi have 31250 baud rate.


Communication between Nextion and Arduino board is only 9600.
I am afraid that communication with Arduino and Nextion will take too much time.
Or is it possible to increase the data rate for Nextion?

@Per


2. switch number. (room for 255 bottons)

If we limit the number of components to 255 in a whole project, some users will complain that they need more than that... :-) Now the limit is 255 pages x 255 components.


Or is it possible to increase the data rate for Nextion?

Yes, you can increase the baud rate up to 115200, see this thread: http://support.iteadstudio.com/support/discussions/topics/1000061212 

(commands "baud=" and "bauds=").

I try to make a small project with page0, page1, Page2,
To use a button to select pages.
I can not find way to select page with b0. Can anyone help me?

select the button on the screen 

under action choose either on press or release tab (also check send keyvalue checkbox)

enter in user code field 


page page0


compile and try that

"page" tells it to switch to the page listed after the command

"page0"references the pages listed on the right side pane

use page1, page2 ect for other pages per corresponding button

example


Thank you very much!
Now it works ok.

Is it possible use the SD card on Nextion to save and load files or other data,
than only load TFT file?

The SD card slot is only for loading the TFT file at present.

It would be the best if the user will have option to set what the button will send if pressed. For example if I press one button it should just send a name or ID of the button, value and CR and LF 0x05 0x01 0x0D 0x0A .
It seems like ITEAD has now introduced two new commands called "print" and "printh", which give the possibility to send the string/value you want.
http://wiki.iteadstudio.com/Nextion_Instruction_Set#print_str
I haven't seen any official announcement from ITEAD about these new commands, so I'm not sure if they can be used now with Nextion Editor v0.26 or if we must wait for the next version.

 

Print and printh works perfectly but you cant print value of an object.

 

@Matej,you may use the "get att" command.

http://wiki.iteadstudio.com/Nextion_Instruction_Set#get_att

Login or Signup to post a comment