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

Files at this revision

API Documentation at this revision

Comitter:
s_shah5
Date:
Fri Aug 12 13:16:01 2016 +0000
Parent:
2:77388e8f0697
Commit message:

Changed in this revision

ESP8266.cpp Show annotated file Show diff for this revision Revisions of this file
ESP8266.h Show annotated file Show diff for this revision Revisions of this file
--- 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);
+}
--- a/ESP8266.h	Sun Dec 28 21:58:49 2014 +0000
+++ b/ESP8266.h	Fri Aug 12 13:16:01 2016 +0000
@@ -34,6 +34,7 @@
 void GetConnStatus(char * st);
 void StartServerMode(int port);
 void CloseServerMode(void);
+void SetAP(char * id, char * pwd, char chl, char ecn);
 
 private:
 Serial comm;