Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include <ESP8266WiFi.h> // Include the Wi-Fi library
  2.  
  3. const char* ssid = "IoT"; // The SSID (name) of the Wi-Fi network you want to connect to
  4. const char* password = "12345iot"; // The password of the Wi-Fi network
  5.  
  6. void setup() {
  7. Serial.begin(74880); // Start the Serial communication to send messages to the computer
  8. delay(10);
  9. Serial.println('\n');
  10.  
  11. WiFi.begin(ssid, password); // Connect to the network
  12. Serial.print("Connecting to ");
  13. Serial.print(ssid); Serial.println(" ...");
  14.  
  15. int i = 0;
  16. while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
  17. delay(1000);
  18. Serial.print(++i); Serial.print(' ');
  19. }
  20.  
  21. Serial.println('\n');
  22. Serial.println("Connection established!");
  23. Serial.print("IP address:\t");
  24. Serial.println(WiFi.localIP()); // Send the IP address of the ESP8266 to the computer
  25. }
  26.  
  27. void loop() { }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement