Serial.readString and pasreInt printing random data

I'm trying to take command using serial monitor in string or integer form but every time i print the data entered through serial monitor it prints random characters (or may be there is a pattern and i can't see it)
I'm using an ardiuno nano and am using android device to program it.

Serial.begin(112500);
}

// the loop routine runs over and over again forever:
void loop() {
//char k[10];
// read the input on analog pin 0:
String a;
a =Serial.readString();

Serial.println(a);

k[0]=0;

delay(2000);

}

The first 4 values are when i entered 1111 as input
And the remaining value are for when i entered 2222.
Thanks in advance.

Please post your complete sketch and explain what you mean by

This is the full sketch

try 115200, instead of 112500
and set the Arduino IDE to the same baud rate.
Also if you are reading Strings from Serial check out my Arduino Software Solutions
for various ways to read from Serial with their pros and cons

@devilsvenom please read How to get the best out of this forum and follow the advice it gives about posting code using code tags

It WORKED!!
Thanks alot.
And also thanks to all of you for replying

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