Serial Monitor Maximum Character length limit

Hi there,

this is just a simple question,

I’m trying to input data to Serial Monitor and the data that I’ve inputted should be appear via Serial.println() which is working fine,

As I’ve noticed, when I tried to input a message to Serial Monitor with more than 60 characters, the 61st
character onwards is not being printed on the screen. Does it mean, Serial Monitor cannot accept bigger/longer data?

For example…

I input the below…

+89xxxxxxxxxx|+89xxxxxxxxxx|+89xxxxxxxxxx|}Hello World this is a test message for Groupings

Output(incomplete)

+89xxxxxxxxxx|+89xxxxxxxxxx|+89xxxxxxxxxx|}Hello World this is

This is my code…

String data;

Void setup(){
Serial.begin(9600);

}

Void Loop(){

data = Serial.readString();

Serial.println(data);
}

This program is intended to be use in SIM900 module where the message from the end user will came from COMPORT using php, however, when i tried, I received only the incomplete message.

Hoping someone could be able to assists.

Kind Regards,

Serial M.JPG

Your code won't compile so it is hard to see how you can get any output. C++ is case sensitive. It does not like Void nor Loop.

Try this code. It prints the whole String for me.

String data;

void setup()
{
   Serial.begin(9600);
   Serial.print("serial");  
}

void loop()
{
  if (Serial.available())
   {
      data = Serial.readString();
      Serial.println(data);
   }
}

Is it that difficult to show a program that compiles? 'void' is with lower case 'v' as is 'loop' with lower case 'l'.

And to use code tags? Newbies should read the post titled "How to use this forum - please read" so they know how to post code.

There is no limitation in serial monitor. It displays what it receives, character by character. There is however a limitation in the software buffer used by the Arduino hardware serial implementation (used by Serial.println) and that is indeed around 60 characters; but it should print the full message (and it indeed does on my system, IDE 1.8.5); it will just delay if there is no space in the software buffer.

Lastly, forget that the String class (with capital S) exists; it will result in difficult to track issues at run time once your program starts making heavy use of String.

Serial data arrives one byte at a time. It is put in a buffer until you read it. If you f**k around and don't read data before the buffer gets full, any data that won't fit in the buffer is just discarded.

If you are not doing anything with the data, as in your example, do NOT use the String class or the blocking readString() method.

Learn to use the available() and read() methods, instead.

The serial input basics tutorial will show how to read serial data into a null terminated character array (string [small s]).

Note that the code in Serial Input Basics assumes a max of 32 characters. You can easily change that by changing the constant numChars

…R