mirror of
https://github.com/H3ALY/Wireless-PC-Switch.git
synced 2026-12-04 14:01:58 +00:00
Create wifi_setup.h
This commit is contained in:
1 parent
3aa4af853a
commit
1856c56799
1 file changed
+26
@@ -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