Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. void setup_wifi() {
  2. delay(10);
  3. // We start by connecting to a WiFi network
  4. Serial.println();
  5. Serial.print("Connecting to ");
  6. Serial.println(wifi_ssid);
  7.  
  8. //Connect to WiFi network so we can reach the MQTT broker and publish messages to topics.
  9. WiFi.mode(WIFI_STA);
  10. WiFi.begin(wifi_ssid, wifi_password);
  11.  
  12. while (WiFi.status() != WL_CONNECTED) {
  13. delay(500);
  14. Serial.print(".");
  15. }
  16.  
  17. Serial.println("");
  18. Serial.print(F("WiFi connected, "));
  19. Serial.print(F("IP address: "));
  20. Serial.println(WiFi.localIP());
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement