Start a new topic

How to send data

Hi to send data from an arduino to nextion display without nextion library for example send temp sensor data from arduino to nextion......

3 people like this idea

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

Hi I bought a temp sensor Ds18b20 I write sketch for it and I can see the result on the arduino serial monitor I like to display the result on nextion display without nextion plz
On hmi file my variable is t0 and the id of my variable is 1

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

#include "Nextion.h"

NexText myt0 = NexText(0,1,"t0");


Thanks for reply I am new to nextion and nextion library is a bit complicated to understand ok for example if my sensor name is temp how should I write code for that using nextion library......

That is not really a Nextion problem, that is an MCU side programming problem

You will have to dig into your documentation a bit

 - Compiler

 - Programming Language

 - Hardware Manuals

Thanks I think I should use nextion library instead of sending data without it.once again thanks for your help.....

Happy Coding


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.write(0x22);  // \"


As you see, you use the same kind of command "Serial.print(xxx)" as with the Serial Monitor.

2 people like this

Hi Raphael. Can you tell me: How to show float number from MCU to Nextion Display? I only can show number in interger format.

Thank you!

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.

1 person likes this

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.