Start a new topic

Sending data to the display from Arduino Uno

Hi All;

I've been working with my Nextion 2.8" display, and Arduino Uno, and I've got them working well together. 

I'm posting some code, maybe somebody on the board can help. The setup reads DS18B20 temperatures and displays on the Nextion, so I get good data all around.

It's my own coding I"m not happy with, specifically, down at the bottom of the page.

 I take the contents of two buffers and display on the screen, but I would like to "streamline" the method I'm using. 

Thanks, if you reply I will appreciate your help and suggestions


Hi I've tried your solution, and it almost works. I'm getting an error " no matching function call for call to 'NexText::setText(String&)' When I include myt3.setText(AddedTogetherStrings); Can you understand the error and the reason for it, thank you

Already stated in Response #3 to this your very own thread.

When you ignore what is written, then for sure errors occur.

Iteadlib Arduino Nextion Library 

  setText() does not use String objects but const char *buffer

The error is clear

  - comes from the compiler saying it can not build from the code as it is.

Take some time to learn your compiler

  - errors must be researched at to learn the reason,

Then strategize how not to fall in same hole over and over and over

Thanks, you are correct, it can't compile. It's only a part of a larger program, and asks only about the better method for sending the data to the nextion, hoping for help from the general community Thanks
Thanks, I will try it and report back. I think you're idea will work and I'm very grateful for your help
It's only part of the greater code. I needed to know how to "mash together" all that buffer stuff and send to the display. The delays allow time for the numbers on the nextion to be read before the next data arrives
I think I understand- by doing what I'm doing, I run the risk of overrunning the buffer in the display. And your calculation says I'm limited to about 10 characters per string sent from the Arduino. Is that correct? I can work with that, thanks.

No this is not correct to assume a buffer so small.  Some of which is dependent on Nextion model as per the Nextion Datasheet for your model.  It would also not be correct to assume this from your Arduino side - again dependent on your MCU's documentation and Manual (the downloadable pdf at Arduino, not the quick specifications) coupled with the Version of the compiler and what is implemented for buffers in the Arduino library code for your MCU.

But your code you presented in not functional and lacks the programming prerequisites - you will need to learn some at, and other code teaching sites.  An MCU is going to do things step by step (line by line), and do exactly as instructed to do.

Baudrate is simple calculation

 - 1/baudrate is minimum time for each bit to be sent

 - 10 bits required for 1 byte

To avoid overflow, do not send more than buffer can handle in timeframe.

 - referred to as controlling flow.

When all else fails, load one of the various examples and study its code.

What is your question?

The community isn't for making code dumps, personal debug dev team, or a blog for code progression

after line 73 add  

String AddedTogetherStrings="";
AddedTogetherStrings = name + buffer;

 Then replace line 74 with 




@William - Iteadlib Arduino Nextion Library doesn't use String.

 - such would only cause an error as parameter is const char *buffer

How was the missing void loop() missed?


4 calls to OneWire @750ms = 3 full seconds in loop()?

No listening to Nextion setup?

12.8 seconds worth of delay() - also destined to loop()?

Sorry Dan

 - with such, buffer overruns are moments away

Thank you very much for your advice

Code does not compile as presented

Login or Signup to post a comment