How does ESP8266 work as web server with Arduino? I am trying to learn internet of things with smart home. I will connect an ESP8266 and an Arduino with the IBM Bluemix server to control a circuit from a public IP.

I want to start with the local network for now. I have gone through a couple of links which seem like a great start http://allaboutee.com/2014/12/30/esp8266-and-arduino-webserver/

They explain how it works, and have source code but no circuit diagram. How should I connect the ESP8266 with Arduino for this example ?





#include &lt;SoftwareSerial.h&gt;

const byte rxPin = 2; // Wire this to Tx Pin of ESP8266
const byte txPin = 3; // Wire this to Rx Pin of ESP8266

// We'll use a software serial interface to connect to ESP8266
SoftwareSerial esp8266(rxPin,txPin);

void setup() {
  Serial.begin(9600);
  esp8266.begin(9600);
  delay(1000);
}

void loop() {
  Serial.println("Sending an AT commands");
  esp8266.println("AT");
  delay(30);
  while(esp8266.available()) {
    String data = esp8266.readStringUntil('\n');
    Serial.println("Got response from esp8266: " + data);
  }
}
The exact same way as any other ESP8266 example. The fact that you are using it as a web server doesn't change how you wire it.

For that specific code snippet it even tells you in the comments:

// make RX Arduino line is pin 2, make TX Arduino line is pin 3.
// This means that you need to connect the TX line from the esp to the Arduino's pin 2
// and the RX line from the esp to the Arduino's pin 3