user20942: Hi I am new to arduino development i was using esp8266 using software serial library

here is the code 

#include<stdlib.h>
#include <SoftwareSerial.h>

SoftwareSerial monitor(2, 3); // RX, TX

void setup()
{
  monitor.begin(9600);
  Serial.begin(9600);

  sendDebug("AT");
  delay(5000);
  Serial.println("Hello");
  if(monitor.find("OK"))
  {
   Serial.println(monitor.available());
   Serial.println((int)monitor.read());
   Serial.println((int)monitor.read());
    Serial.println(monitor.available());
   Serial.println("RECEIVED: OK");
    //connectWiFi();
  }
  else
  {
    Serial.println("RECEIVED: None");
  }
}

void loop(){

}


void sendDebug(String cmd){
  monitor.println(cmd);
  Serial.println("Command: "+cmd);
}


Output

Command: AT
Hello
2
13
10
0
RECEIVED: OK

All I know is monitor.available() return the available bytes that can be read and i can also deduce that these two bytes are O and K but the integer value doesn't corresponds to the ascii value of O and K
can anyone explain what is actually getting printed on the serial monitor what is 13 and 10 ? ??

user6628: It is just like https://www.arduino.cc/en/Serial/Read : 
The monitor.find("OK"); already consumed the 'O' and the 'K' bytes, (see https://www.arduino.cc/en/Serial/Find ) then there were two bytes .available(), a 13=CarriageReturn and a 10=LineFeed, both returned by successive monitor.read()s, then zero more bytes in monitor.available().

20942: <p>Hi I am new to arduino development i was using esp8266 using software serial library</p>

<blockquote>
  <p>here is the code </p>
</blockquote>

<pre><code>#include&lt;stdlib.h&gt;
#include &lt;SoftwareSerial.h&gt;

SoftwareSerial monitor(2, 3); // RX, TX

void setup()
{
  monitor.begin(9600);
  Serial.begin(9600);

  sendDebug("AT");
  delay(5000);
  Serial.println("Hello");
  if(monitor.find("OK"))
  {
   Serial.println(monitor.available());
   Serial.println((int)monitor.read());
   Serial.println((int)monitor.read());
    Serial.println(monitor.available());
   Serial.println("RECEIVED: OK");
    //connectWiFi();
  }
  else
  {
    Serial.println("RECEIVED: None");
  }
}

void loop(){

}


void sendDebug(String cmd){
  monitor.println(cmd);
  Serial.println("Command: "+cmd);
}
</code></pre>

<blockquote>
  <p>Output</p>
</blockquote>

<pre><code>Command: AT
Hello
2
13
10
0
RECEIVED: OK
</code></pre>

<p><em>All I know is <code>monitor.available()</code> return the available bytes that can be read and i can also deduce that these two <strong>bytes</strong> are <strong>O</strong> and <strong>K</strong> but the integer value doesn't corresponds to the <strong>ascii</strong> value of <strong>O</strong> and <strong>K</em></strong></p>

<p>can anyone explain what is actually getting printed on the serial monitor what is <strong>13</strong> and <strong>10</strong> ? ??</p>
 6628: <p>It is just like <a href="https://www.arduino.cc/en/Serial/Read" rel="nofollow">https://www.arduino.cc/en/Serial/Read</a> : </p>

<p>The <code>monitor.find("OK");</code> already consumed the 'O' and the 'K' bytes, (see <a href="https://www.arduino.cc/en/Serial/Find" rel="nofollow">https://www.arduino.cc/en/Serial/Find</a> ) then there were two bytes .available(), a 13=CarriageReturn and a 10=LineFeed, both returned by successive <code>monitor.read()</code>s, then zero more bytes in monitor.available().</p>
