user26135: I am doing some experiments with nodemcu 12 (which has built in esp8266). There most of the tutorials I found by internet describe how to connect to home wifi connection using it. 
But when I power on nodemcu, I can see wifi network called "ESPXXX" in my laptop's wifi connection list. 
So is there a way to directly connect to the wifi nw of esp8266 by my laptop or via another esp8266 (so I don't have to switch on my home wifi router)? 
If it is possible, is there is way to change ssid of esp8266's wifi connection and add password (again this is not about connecting to home wifi and this is about the wifi connection on esp8266 it self)? 
So we can make one esp8266 as a wifi host and connect other esp8266s as slave to it. 
I am using arduino IDE to upload program into esp8266 and not Lua.
Thanks.

user28768: Here you are the working code allowing you to choose SSID, password, network name and IP address of your ESP8266 acting as an access point. In addition, you can specify wifi channel to avoid interference with other devices. A password must be at least 8 characters long or it wouldn't work.
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

IPAddress ip(192,168,1,81);         // choose IP address
IPAddress subnet(255,255,255,0);

ESP8266WebServer server(80);

void handleRoot() {
  String page = "<!DOCTYPE html>\n";

  page += "<html>\n<body>\n<h1>Some heading</h1><br>Generated by ESP8266\n</body>\n</html>";
  server.send(200, "text/html", page);
}

// what to do when accessed through http://ip_address/something_undefined
void handleNotFound(){
  String message = "File not found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET)?"GET":"POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i=0; i<server.args(); i++){
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
}

void setup(void){
  Serial.begin(74880);                      // so you can see debug messages automatically sent by ESP8266
  WiFi.mode(WIFI_AP);
  WiFi.softAPConfig(ip, ip, subnet);        // declared as: bool softAPConfig (IPAddress local_ip, IPAddress gateway, IPAddress subnet)
  WiFi.softAP("SOME_NAME", "password", 7);  // network name, network password, wifi channel

  IPAddress myIP = WiFi.softAPIP();
  Serial.println();
  Serial.print("AP IP address: ");
  Serial.println(myIP);

  server.on("/", handleRoot);               // what to do when accessed through browser using http://IP_address

  // what to do when accessed through http://ip_address/test
  server.on("/test", [](){
    server.send(200, "text/plain", "This is another page");
  });

  server.onNotFound(handleNotFound);

  server.begin();
  Serial.println("HTTP server started...");
}

void loop(void){
  server.handleClient();
}

You can write something like:
server.on("/open_door", [](){
        // the code to switch on the relay to open the door
        // ... <-- put here the code
        server.send(200, "text/html", "Door: opened");
});

so you can open the door with http://ip_address/open_door.
You can try http://ip_address/something_undefined?a=24&b=25 to get an idea how to process the parameters.

26135: <p>I am doing some experiments with nodemcu 12 (which has built in esp8266). There most of the tutorials I found by internet describe how to connect to home wifi connection using it. </p>

<p>But when I power on nodemcu, I can see wifi network called "ESPXXX" in my laptop's wifi connection list. </p>

<p>So is there a way to directly connect to the wifi nw of esp8266 by my laptop or via another esp8266 (so I don't have to switch on my home wifi router)? </p>

<p>If it is possible, is there is way to change ssid of esp8266's wifi connection and add password (again this is not about connecting to home wifi and this is about the wifi connection on esp8266 it self)? 
So we can make one esp8266 as a wifi host and connect other esp8266s as slave to it. </p>

<p>I am using arduino IDE to upload program into esp8266 and not Lua.</p>

<p>Thanks.</p>
 28768: <p>Here you are the working code allowing you to choose <code>SSID</code>, <code>password</code>, <code>network name</code> and <code>IP address</code> of your ESP8266 acting as an access point. In addition, you can specify <code>wifi channel</code> to avoid interference with other devices. A password must be at least 8 characters long or it wouldn't work.</p>

<pre class="lang-cpp prettyprint-override"><code>#include &lt;ESP8266WiFi.h&gt;
#include &lt;WiFiClient.h&gt;
#include &lt;ESP8266WebServer.h&gt;

IPAddress ip(192,168,1,81);         // choose IP address
IPAddress subnet(255,255,255,0);

ESP8266WebServer server(80);

void handleRoot() {
  String page = "&lt;!DOCTYPE html&gt;\n";

  page += "&lt;html&gt;\n&lt;body&gt;\n&lt;h1&gt;Some heading&lt;/h1&gt;&lt;br&gt;Generated by ESP8266\n&lt;/body&gt;\n&lt;/html&gt;";
  server.send(200, "text/html", page);
}

// what to do when accessed through http://ip_address/something_undefined
void handleNotFound(){
  String message = "File not found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET)?"GET":"POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i=0; i&lt;server.args(); i++){
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
}

void setup(void){
  Serial.begin(74880);                      // so you can see debug messages automatically sent by ESP8266
  WiFi.mode(WIFI_AP);
  WiFi.softAPConfig(ip, ip, subnet);        // declared as: bool softAPConfig (IPAddress local_ip, IPAddress gateway, IPAddress subnet)
  WiFi.softAP("SOME_NAME", "password", 7);  // network name, network password, wifi channel

  IPAddress myIP = WiFi.softAPIP();
  Serial.println();
  Serial.print("AP IP address: ");
  Serial.println(myIP);

  server.on("/", handleRoot);               // what to do when accessed through browser using http://IP_address

  // what to do when accessed through http://ip_address/test
  server.on("/test", [](){
    server.send(200, "text/plain", "This is another page");
  });

  server.onNotFound(handleNotFound);

  server.begin();
  Serial.println("HTTP server started...");
}

void loop(void){
  server.handleClient();
}
</code></pre>

<p>You can write something like:</p>

<pre class="lang-cpp prettyprint-override"><code>server.on("/open_door", [](){
        // the code to switch on the relay to open the door
        // ... &lt;-- put here the code
        server.send(200, "text/html", "Door: opened");
});
</code></pre>

<p>so you can open the door with <code>http://ip_address/open_door</code>.</p>

<p>You can try <code>http://ip_address/something_undefined?a=24&amp;b=25</code> to get an idea how to process the parameters.</p>
