23 lines
445 B
C
23 lines
445 B
C
|
#ifndef THEWIFI_H
|
||
|
#define THEWIFI_H
|
||
|
|
||
|
#include "esp32-hal-log.h"
|
||
|
#include "WiFi.h"
|
||
|
#include "theSecrets.h"
|
||
|
|
||
|
const char *serverIp;
|
||
|
|
||
|
void connectWifi()
|
||
|
{
|
||
|
log_i("Attempting to connect to WPA SSID: %s", ssid);
|
||
|
WiFi.mode(WIFI_STA);
|
||
|
WiFi.begin(ssid, psk);
|
||
|
while (WiFi.status() != WL_CONNECTED)
|
||
|
{
|
||
|
delay(1000);
|
||
|
}
|
||
|
serverIp = WiFi.localIP().toString().c_str();
|
||
|
log_i("Connected, IP Address: %s", serverIp);
|
||
|
}
|
||
|
|
||
|
#endif
|