Guest User

Untitled

a guest
Oct 17th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <ESP8266WiFi.h>
  2.  
  3. const char *ap_ssid = "ESP8266";
  4. const char *ap_password = "12345678";
  5.  
  6. const char *sta_ssid = "Your router name";
  7. const char *sta_password = "Your router password";
  8.  
  9. void setup() {
  10. Serial.begin(115200);
  11. Serial.println();
  12. WiFi.mode(WIFI_AP_STA);
  13.  
  14. Serial.print("Configuring access point...");
  15. WiFi.softAP(ap_ssid, ap_password);
  16.  
  17. IPAddress myIP = WiFi.softAPIP();
  18. Serial.print("AP IP address: ");
  19. Serial.println(myIP);
  20.  
  21. Serial.println();
  22. Serial.print("Connecting to ");
  23. Serial.println(sta_ssid);
  24. WiFi.begin(sta_ssid, sta_password);
  25.  
  26. while (WiFi.status() != WL_CONNECTED) {
  27. delay(500);
  28. Serial.print(".");
  29. }
  30.  
  31. Serial.println("");
  32. Serial.println("WiFi connected");
  33. Serial.println("IP address: ");
  34. Serial.println(WiFi.localIP());
  35. }
  36.  
  37. void loop() {
  38. }
Add Comment
Please, Sign In to add comment