Modified Library for using the Wifi module ESP8266, first version with basic commands, soon new commands will be added

Fork of ESP8266 by Antonio Quevedo

Revision:
3:8a8fb2e0958c
Parent:
2:77388e8f0697
--- a/ESP8266.cpp	Sun Dec 28 21:58:49 2014 +0000
+++ b/ESP8266.cpp	Fri Aug 12 13:16:01 2016 +0000
@@ -165,4 +165,27 @@
     char rs[20];
     strcpy(rs, "AT+CIPSERVER=0");
     SendCMD(rs);
-}
\ No newline at end of file
+}
+
+// Set Access Point of WIFI.
+void ESP8266::SetAP(char * id, char * pwd, char chl, char ecn)
+{
+    char cmd[255];
+    strcpy(cmd, "AT+CWSAP=");
+    AddChar(cmd, 0x22);
+    strcat(cmd, id);    //Setting AP ssid
+    AddChar(cmd, 0x22);
+    AddChar(cmd, 0x2C);
+    AddChar(cmd, 0x22);
+    strcat(cmd, pwd);      //Setting AP pwd
+    AddChar(cmd, 0x22);
+    AddChar(cmd, 0x2C);
+    AddChar(cmd, 0x22);
+    AddChar(cmd, chl);  //Setting AP channel No.
+    AddChar(cmd, 0x22);
+    AddChar(cmd, 0x2C);
+    AddChar(cmd, 0x22);
+    AddChar(cmd, ecn);  //Setting AP encryption. <0> Open, <1> WEP, <2> WPA_PSK,<3> WPA2_PSK,<4> WPA_WPA2_PSK
+    AddChar(cmd, 0x22);
+    SendCMD(cmd);
+}