mirror of
https://github.com/H3ALY/Wireless-PC-Switch.git
synced 2025-12-19 18:28:22 +00:00
Create wifi_setup.h
This commit is contained in:
committed by
GitHub
parent
3aa4af853a
commit
1856c56799
26
wifi_setup.h
Normal file
26
wifi_setup.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#ifndef WIFI_SETUP_H
|
||||||
|
#define WIFI_SETUP_H
|
||||||
|
|
||||||
|
#include <ESP8266WiFi.h>
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
class WiFiManager {
|
||||||
|
public:
|
||||||
|
void setup_wifi() {
|
||||||
|
Serial.print("Connecting to ");
|
||||||
|
Serial.print(ssid); // Use Serial.print instead of Serial.println
|
||||||
|
WiFi.begin(ssid, password);
|
||||||
|
|
||||||
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
|
delay(500);
|
||||||
|
Serial.print(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
Serial.println("");
|
||||||
|
Serial.println("WiFi connected");
|
||||||
|
Serial.print("IP address: ");
|
||||||
|
Serial.println(WiFi.localIP());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user