user34636: G'day guys, I'm trying to get an ESP8266 to work with an Arduino Uno.Here is the wiring.
When I go to the serial monitor (115200 baud) and type: AT, there is not response from the ESP8266.Is there something that I am missing?I also have a servo motor connected, it works fine.

include "Arduino.h"
include "ESP8266.h"
include "dweet.h"
include "Servo.h"

define ESP8266_PIN_RX 10
define ESP8266_PIN_TX 11
define SERVO9G_PIN_SIG 2

const int servo9gRestPosition   = 20;
const int servo9gTargetPosition = 150;
const char *SSID     = "Wireless Network";
const char *PASSWORD = "wireless_password";

ESP8266 wifi(ESP8266_PIN_RX,ESP8266_PIN_TX);
Servo servo9g;

const int timeout = 10000;
char menuOption = 0;
long time0;

void setup() 
{
   Serial.begin(9600);
   while (!Serial); //await connection.
   Serial.println("start");

   wifi.init(SSID, PASSWORD);
   servo9g.attach(SERVO9G_PIN_SIG);
   servo9g.write(servo9gRestPosition);
   delay(100);
   servo9g.detach();

}

void loop() 
{ 
   servo9g.attach(SERVO9G_PIN_SIG);       
   servo9g.write(servo9gTargetPosition);  
   delay(500);                            
   servo9g.write(servo9gRestPosition);    
   delay(500);                              
   servo9g.detach(); 
}

I'm using the ESP8266 Library.When trying to connect it just says Initializing device...

user30341: Unless you have some project constraints which make it mandatory to use naked ESP8266, why not use a NodeMCU to communicate with the Arduino in a master/slave relation over I2C?

#include <Wire.h>  
#define I2CAddressESPWifi 8

in setup()
Wire.begin(D1,D2); // SCL D1 SDA D2

then call from anywhere inside your loop() call this function
char readSlave(int x) { // send current time
  String xY = String(x);
  char c;
  int charArrayLength = xY.length()+1;
  char bufferChar[charArrayLength];
  Wire.beginTransmission(8);
  xY.toCharArray(bufferChar, charArrayLength);
  Wire.write(bufferChar);
  Wire.endTransmission();
  delay(10);
  Serial.print("wire sent: [");
  Serial.print(x);
  delay(50);//Wait for Slave to calculate response.
  int counter = 0;
  char buffMe[32];
  int bytesIn = Wire.requestFrom(8,32);
  while (Wire.available()) {
    delay(2);
    buffMe[counter] = Wire.read();
    /*
    c = Wire.read();
    Serial.print(c);
    */
    counter++;
  }
  delay(10);
  Wire.endTransmission(); 
  delay(500);
  Serial.print("] bytesIn: [");
  Serial.print(bytesIn);
  Serial.print("] buffMe: [");
  Serial.print(buffMe);
  Serial.print("]");
  return buffMe;
}

and your arduino will be waiting (setup)
Serial.begin(9600);
// slave listens for call from master NodeMCU
Wire.begin(I2CAddressESPWifi);  // predefined as `8` or whatever address you choose
Wire.onReceive(receiveEvent);
Wire.onRequest(requestEvent);

and at the end of your code
void receiveEvent(int howMany) {
  if (howMany) {
    Serial.print("bytes[");
    Serial.print(howMany);
    Serial.print("] Received[");
    char charIn[howMany];
    int counter = 0;
    while (Wire.available()) {
      char c = Wire.read();
      charIn[counter] = c;
      //Serial.print(c);
      counter++;
    }
    delay(10);
    //do something with command from master
  }
}
void requestEvent() {
  char bufferChar[20] = "slave answer string";  // automatically null terminated extra character at end
  Serial.println(bufferChar);
  Wire.write(bufferChar);
}


34636: <p>G'day guys, I'm trying to get an ESP8266 to work with an Arduino Uno.<br>Here is the wiring.<br><br><br><a href="https://i.stack.imgur.com/JV3sP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JV3sP.png" alt="wiringPicture"></a></p>

<p>When I go to the serial monitor (115200 baud) and type: AT, there is not response from the ESP8266.<br><br>Is there something that I am missing?<br><br>I also have a servo motor connected, it works fine.
</p>

<pre class="lang-cpp prettyprint-override"><code>include "Arduino.h"
include "ESP8266.h"
include "dweet.h"
include "Servo.h"

define ESP8266_PIN_RX 10
define ESP8266_PIN_TX 11
define SERVO9G_PIN_SIG 2

const int servo9gRestPosition   = 20;
const int servo9gTargetPosition = 150;
const char *SSID     = "Wireless Network";
const char *PASSWORD = "wireless_password";

ESP8266 wifi(ESP8266_PIN_RX,ESP8266_PIN_TX);
Servo servo9g;

const int timeout = 10000;
char menuOption = 0;
long time0;

void setup() 
{
   Serial.begin(9600);
   while (!Serial); //await connection.
   Serial.println("start");

   wifi.init(SSID, PASSWORD);
   servo9g.attach(SERVO9G_PIN_SIG);
   servo9g.write(servo9gRestPosition);
   delay(100);
   servo9g.detach();

}

void loop() 
{ 
   servo9g.attach(SERVO9G_PIN_SIG);       
   servo9g.write(servo9gTargetPosition);  
   delay(500);                            
   servo9g.write(servo9gRestPosition);    
   delay(500);                              
   servo9g.detach(); 
}
</code></pre>

<p>I'm using the ESP8266 Library.<br>When trying to connect it just says <code>Initializing device...</code></p>
 30341: <p>Unless you have some project constraints which make it mandatory to use naked ESP8266, why not use a NodeMCU to communicate with the Arduino in a master/slave relation over I2C?</p>

<p><a href="https://i.stack.imgur.com/GFLO6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GFLO6.png" alt="enter image description here"></a></p>

<pre><code>#include &lt;Wire.h&gt;  
#define I2CAddressESPWifi 8
</code></pre>

<p>in <code>setup()</code></p>

<pre><code>Wire.begin(D1,D2); // SCL D1 SDA D2
</code></pre>

<p>then call from anywhere inside your <code>loop()</code> call this function</p>

<pre><code>char readSlave(int x) { // send current time
  String xY = String(x);
  char c;
  int charArrayLength = xY.length()+1;
  char bufferChar[charArrayLength];
  Wire.beginTransmission(8);
  xY.toCharArray(bufferChar, charArrayLength);
  Wire.write(bufferChar);
  Wire.endTransmission();
  delay(10);
  Serial.print("wire sent: [");
  Serial.print(x);
  delay(50);//Wait for Slave to calculate response.
  int counter = 0;
  char buffMe[32];
  int bytesIn = Wire.requestFrom(8,32);
  while (Wire.available()) {
    delay(2);
    buffMe[counter] = Wire.read();
    /*
    c = Wire.read();
    Serial.print(c);
    */
    counter++;
  }
  delay(10);
  Wire.endTransmission(); 
  delay(500);
  Serial.print("] bytesIn: [");
  Serial.print(bytesIn);
  Serial.print("] buffMe: [");
  Serial.print(buffMe);
  Serial.print("]");
  return buffMe;
}
</code></pre>

<p>and your arduino will be waiting (<code>setup</code>)</p>

<pre><code>Serial.begin(9600);
// slave listens for call from master NodeMCU
Wire.begin(I2CAddressESPWifi);  // predefined as `8` or whatever address you choose
Wire.onReceive(receiveEvent);
Wire.onRequest(requestEvent);
</code></pre>

<p>and at the end of your code</p>

<pre><code>void receiveEvent(int howMany) {
  if (howMany) {
    Serial.print("bytes[");
    Serial.print(howMany);
    Serial.print("] Received[");
    char charIn[howMany];
    int counter = 0;
    while (Wire.available()) {
      char c = Wire.read();
      charIn[counter] = c;
      //Serial.print(c);
      counter++;
    }
    delay(10);
    //do something with command from master
  }
}
void requestEvent() {
  char bufferChar[20] = "slave answer string";  // automatically null terminated extra character at end
  Serial.println(bufferChar);
  Wire.write(bufferChar);
}
</code></pre>
