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
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()?
- with such, buffer overruns are moments away
Code does not compile as presented
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.
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 arduino.cc, 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.
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 arduino.cc to learn the reason,
Then strategize how not to fall in same hole over and over and over