user42621: Can not initialize ESP module in Arduino SoftwareSerial's example sketch in configuring WiFi module.
In the sketch it tells:
#include "WiFiEsp.h"
// Emulate Serial1 on pins 6/7 if not present
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(11,12); // RX, TX
#endif

I plugged jumper wires in from esp8266 RX to Digital 11 of mega which is RX and TX of esp8266 to Digital 12 of mega, and I compile the code and looked at the Serial Monitor, but it says:
[WiFiEsp] Initializing ESP module
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] >>> TIMEOUT >>>
[WiFiEsp] Cannot initialize ESP module

Advise is greatly appreciated.

user26916: #ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(11,12); // RX, TX
#endif

Because your Mega has a Hardware Serial1 port, HAVE_HWSERIAL1 is defined. Thus the lines inside that preprocessor conditional will not be compiled. This means you should connect the ESP8266 to the Serial1 lines on your Mega:
Mega | ESP8266
--------------
19   | TX
18   | RX


42621: <p>Can not initialize <strong><em>ESP module</em></strong> in Arduino SoftwareSerial's example sketch in configuring <strong><em>WiFi module</em></strong>.</p>

<p>In the sketch it tells:</p>

<pre><code>#include "WiFiEsp.h"
// Emulate Serial1 on pins 6/7 if not present
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(11,12); // RX, TX
#endif
</code></pre>

<p>I plugged jumper wires in from esp8266 RX to Digital 11 of mega which is RX and TX of esp8266 to Digital 12 of mega, and I compile the code and looked at the Serial Monitor, but it says:</p>

<pre><code>[WiFiEsp] Initializing ESP module
[WiFiEsp] &gt;&gt;&gt; TIMEOUT &gt;&gt;&gt;
[WiFiEsp] &gt;&gt;&gt; TIMEOUT &gt;&gt;&gt;
[WiFiEsp] &gt;&gt;&gt; TIMEOUT &gt;&gt;&gt;
[WiFiEsp] &gt;&gt;&gt; TIMEOUT &gt;&gt;&gt;
[WiFiEsp] &gt;&gt;&gt; TIMEOUT &gt;&gt;&gt;
[WiFiEsp] Cannot initialize ESP module
</code></pre>

<p>Advise is greatly appreciated.</p>
 26916: <pre class="lang-cpp prettyprint-override"><code>#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(11,12); // RX, TX
#endif
</code></pre>

<p>Because your Mega has a Hardware <code>Serial1</code> port, <code>HAVE_HWSERIAL1</code> is defined. Thus the lines inside that preprocessor conditional will not be compiled. This means you should connect the ESP8266 to the <code>Serial1</code> lines on your Mega:</p>

<pre class="lang-none prettyprint-override"><code>Mega | ESP8266
--------------
19   | TX
18   | RX
</code></pre>
