Start a new topic

Arduino Mega and 7'' Nextion HMI Screen

Helo Guys...

I need your help. I have an Arduino project with Mega and Nextion HMI TFT Screen. Firstly I explain what I want to do. I have a LM35 Heat Sensor and I can read and write value on Arduino Serial Monıtor. But I cant read and write Nextion HMI TFT Screen. HMI Screen is more complicated 2x16 LCD Screen. So guys if I can share my codes will you help me the finish this project. Thanks everyone. I hope you will. See you soon..


Nextion uses mostly simple text over serial terminated with three bytes of 0xFF 0xFF 0xFF

https://www.itead.cc/wiki/Nextion_Instruction_Set


Iteadlib Arduino Nextion Library makes this a bit easier

https://github.com/itead/ITEADLIB_Arduino_Nextion

(Already configured for Mega's Serial2


Click the Help Menu Item under the Help Menu

Scroll down and check out

Nextion Editor Quick Start Guide


A Text Component in your HMI called t0 uses

  t0.txt="Hello"ÿÿÿ


A Number Component in your HMI called n0 uses  

  n0.txt=142ÿÿÿ


This can be done with Serial2.print("n0.txt=142ÿÿÿ")

or declaring a NexNumber variable n0 and using n0.setValue();


Nextion Forum - Nextion Questions

but perhaps Arduino Forum - for Arduino Questions on coding.


Check through the Nextion forum - many ideas and answers already exist

You will not find anyone to do your task and to write the code for you. But I can point you towards the solution. Several steps are needed: 1) Download and install the Nextion Editor software and design the screen side for your project. Basically, it is sufficient to choose a background color, to create a font in an appropriate size and a text box to display whatever you want to display. Upload it to your Nextion display. 2a) Download and install the Nextion Arduino library and integrate the appropriate object initialization and function calls into your Arduino sketch. This will allow you to display the values of the LM35 sensor on the Nextion instead of printing them to the Serial monitor. Or... 2b) Study the Nextion instruction set and write your own code to format and send the LM35 values to the HMI text box which you created in step 1 over Serial. The Serial.printf() function will be very helpful to allow a well formatted numeric output. This is much easier to accomplish for a simple project like yours and saves you the overhead of an additional library. That's all.

Dear Thierry Frenkel


I didnt want to anyone write my codes for me. I just say it I cant do it. I am asking all of you what am I doing wrong. when I used the libraries it gives too many codes fail. But too many people says " You can do it without libraries " I am just wondered how can I do without libraries.


firstly I think abuot connection with Serial ports maybe there is something wrong on connection types but I try to already exist project but I never writed any value on HMI screen.


By the way I already downloaded Nextion Editor and do my pages design. 



I just need to know which codes uses to writed printing on value expect LM35 codes 


Thanks everyone and you MR. Thierry. Have good work all of you.

What codes failed ... example of what you send to the Nextion?

@Cengiz

If you want to send data to Nextion without using a library, you can see this thread:

http://support.iteadstudio.com/support/discussions/topics/11000010471

Login or Signup to post a comment