Advertisement
pleasedontcode

WiFi Setup rev_01

Jul 4th, 2025
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: WiFi Setup
  13.     - Source Code NOT compiled for: ESP8266 NodeMCU V1.0
  14.     - Source Code created on: 2025-07-04 22:31:49
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* Implement a Wi-Fi connection feature using the */
  21.     /* ESP8266 NodeMCU V1.0 to enable remote control of */
  22.     /* connected devices. */
  23. /****** END SYSTEM REQUIREMENTS *****/
  24.  
  25. /* START CODE */
  26.  
  27. /****** DEFINITION OF LIBRARIES *****/
  28. // Include the ESP8266WiFi library for Wi-Fi connectivity
  29. #include <ESP8266WiFi.h>
  30.  
  31. /****** FUNCTION PROTOTYPES *****/
  32. void setup(void);
  33. void loop(void);
  34.  
  35. // Wi-Fi network credentials
  36. const char* ssid = "Your_SSID";       // Replace with your Wi-Fi SSID
  37. const char* password = "Your_PASSWORD"; // Replace with your Wi-Fi password
  38.  
  39. void setup(void)
  40. {
  41.     // put your setup code here, to run once:
  42.     Serial.begin(115200);
  43.     delay(10);
  44.     Serial.println();
  45.     Serial.println("Connecting to WiFi...");
  46.  
  47.     // Initiate Wi-Fi connection
  48.     WiFi.begin(ssid, password);
  49.  
  50.     // Wait for connection
  51.     while (WiFi.status() != WL_CONNECTED) {
  52.         delay(500);
  53.         Serial.print(".");
  54.     }
  55.  
  56.     Serial.println("");
  57.     Serial.println("WiFi connected");
  58.     Serial.print("IP address: ");
  59.     Serial.println(WiFi.localIP());
  60. }
  61.  
  62. void loop(void)
  63. {
  64.     // put your main code here, to run repeatedly:
  65.     // For example, you can add code to handle remote control commands
  66. }
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement