Skip to main content
string with a lowercase s is not allowed. It should be with uppercase S.
Source Link

If you really want a string. Try using Serial.readString(). It will return the full string.

The code could look like this:

if(Serial.available()  > 0)
{
  stringString message = Serial.readString();
  Serial.println(message);
}

If you really want a string. Try using Serial.readString(). It will return the full string.

The code could look like this:

if(Serial.available()
{
  string message = Serial.readString();
  Serial.println(message);
}

If you really want a string. Try using Serial.readString(). It will return the full string.

The code could look like this:

if(Serial.available()  > 0)
{
  String message = Serial.readString();
  Serial.println(message);
}
Source Link
Dat Ha
  • 2.9k
  • 6
  • 25
  • 46

If you really want a string. Try using Serial.readString(). It will return the full string.

The code could look like this:

if(Serial.available()
{
  string message = Serial.readString();
  Serial.println(message);
}