Problem with instruction Serial.readStringUntil(char)

Hello,
I am testing a little application using a nextion screen and a arduino uno R3.
When I want to received the strind sent by the nextion screen to the ardiuno thrue the serial (TX, RX), wheb I use Serial.readString(), it is working.
But if I try the instruction Serial.readStringUntil(char), the compiler sned a warning and doesn't take the instruction.
Somebody can help me?
Daniel

Hello multimedia999

Post your sketch, well formated, with comments and in so called code tags "</>" and schematic to see how we can help.

Have a nice day and enjoy coding in C++.

What warning? I suspect you tried to send a string "\n" instead of a character '\n'.

Here is the code:
Actually I have another poblem , it seems that my arduino is dead !!!!!! :frowning: but before he die

String fromnextion=" ";
String signe=" ";
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
Serial.begin(9600);
Serial.setTimeout(100);

// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
/* Print a message to the LCD.
lcd.setCursor(4,0);
lcd.print(distance);
lcd.setCursor(13,0);
lcd.print("=>");
lcd.setCursor(1,0);
lcd.print("<="); */
}

void loop() {
// set the cursor to column 0, line 0
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 0);

fromnextion=Serial.readString(); /* if I replace this line by
fromnextion=Serial.readStringUntil("#"); I have a
warning */

signe=fromnextion.substring(0,1);
lcd.print("");
lcd.setCursor(0,1);
lcd.print(fromnextion);

As I said. You are trying to pass a string literal ("#") instead of a character literal ('#').

Do you understand/know the difference between "#" (# is within pair of double quotes) an '#' (# is within pair of single quotes)?

Ok , I will try as soon I will have the possibility , and I come back to give the result.
Thanks a lot for your time.
Daniel

Hello @multimedia999,
As you are posting in the English section of the forum please could you edit your title to be in English?

I thank you.

Ok, it is ok for the compiler, but the result is not what I expected. I expected the string before the limiter.
But I will work in another way.
My arduino is not dead. That's only that it cannot upload the sketch if the RTX is in use with another component (like a nextion screen)

What do you mean by writing this?
please describe in detail:
what is the complete string that the nextion display is sending?
what do you receive?

Me personal I prefer sending userdefined strings over the nextion-standard strings in combination with non-blocking receiving
This means quite some modifications to the code but the advantage is that the microcontroller is responsive to nextion input all the time
user-defined strings were sent with the nextion-function prints
best regards Stefan

That is my own string defined in the even of a button, I send it to the arduino by the serial interface

You could modify your string to have a start-character and an end-character and then use non-blocking receiving like explained in the serial input basics tutorial example 3 receive with start / end-character
example

start-character "<"
end-character ">"

Start and end-character can be included or excluded in the variable that is used for receiving

best regards Stefan

Here is my way of working with Nextion displays:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.