-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWifi.ino
35 lines (31 loc) · 855 Bytes
/
Wifi.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
void initWifi() {
delay (300);
//SSID von Nextion
char cNexSSID [20];
memset(cNexSSID, 0, sizeof(cNexSSID));
NexSSID.getText(cNexSSID, sizeof(cNexSSID));
//Passwort von Nextion
char cNexpass [20];
memset(cNexpass, 0, sizeof(cNexpass));
Nexpass.getText(cNexpass, sizeof(cNexpass));
#ifdef DEBUG_WIFI
Serial.print("Verbinde zu Netzwerk: ");
Serial.print(cNexSSID);
#endif
WiFi.mode(WIFI_STA);
IPAddress ip(192, 168, 1, 27);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress dns(192, 168, 1, 1);
WiFi.config(ip, dns, gateway, subnet);
WiFi.begin(cNexSSID, cNexpass);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
#ifdef DEBUG_WIFI
Serial.print(".");
#endif
}
#ifdef DEBUG_WIFI
Serial.println(" Verbunden mit Netzwerk \n");
#endif
}