What data do you want to send?
More info on destination is needed
And please limit your question to this thread rather than spamming the board
Why would you want to do without the Nextion Library?
As per the Nextion Instruction Set all commands are to be data terminated
- with three bytes of hexadecimal 0xFF equivalent to a byte of 255 or char ÿ.
Changing a string attribute requires the value to be encased in double quotes
Changing a numeric attribute does not require the value to be encased in double quotes.
This you must format as needed and send via the serial port Nextion is on
Using the Nextion Library
NexText myt0 = NexText(0,1,"t0");
That is not really a Nextion problem, that is an MCU side programming problem
You will have to dig into your documentation a bit
- Programming Language
- Hardware Manuals
It's very simple to send the temperature to your Nextion display without using the library. You can use something like that:
#define SerialNxtn Serial1 // <== Change Serial1 to what you are using float tempDs18b20; // ... Some code to read the temperature from DS18B20 // Send temperature to Nextion, text component t0: SerialNxtn.print("t0"); SerialNxtn.print(".txt="); SerialNxtn.write(0x22); // \" SerialNxtn.print(tempDs18b20); SerialNxtn.write(0x22); SerialNxtn.write(0xFF); SerialNxtn.write(0xFF); SerialNxtn.write(0xFF);
As you see, you use the same kind of command "Serial.print(xxx)" as with the Serial Monitor.
Hi Raphael. Can you tell me: How to show float number from MCU to Nextion Display? I only can show number in interger format.
Nextion is an integer based device without floating point math.
As such as you can only show number in integer format /
However, two approaches can be taken
- 1) split float into two parts, whole and fractional
display each to their respective number components
(available as numbers for Nextion side math)
- 2) convert to text format
display in a Text Component
(cov command will not convert a float)
In Raphael's example above t0 is a Text Component
- parses out to t0.txt="23.5"ÿÿÿ where 23.5 is .print(tempDs18b20);
His publically posted code example answers exactly your question.
Yes, your help is useful with me. But now I have a case, that is :
When I send data from MCU to Display via UART, I want the display check that data.
Such as when MCU send "30.5" to t0, How to display auto show that data for t1 same t0?
It mean what code for Display.