This commit is contained in:
hans-jurgen 2023-06-04 14:54:03 +02:00
parent f2c55132c3
commit ad6ce61e45

View File

@ -53,7 +53,6 @@ unsigned long endTime;
#include <Wire.h>
#include <WiFi.h>
#include <PubSubClient.h>
#define mqtt_port 61883
WiFiClient espClient;
PubSubClient client(espClient);
@ -95,10 +94,11 @@ uint16_t myCOLORS[8]={myRED,myGREEN,myBLUE,myWHITE,myYELLOW,myCYAN,myMAGENTA,myB
// Wifi
char ssid[] = "St.-Peters-Gasse"; // your network SSID (name)
char pass[] = "1952994784599317"; // your network password
IPAddress ip( 192, 168, 127, 247);
IPAddress gateway( 192, 168, 127, 1 );
IPAddress subnet( 255, 255, 255, 0 );
IPAddress dns(192, 168, 127, 1); // DNS-Server
IPAddress ip;
IPAddress gateway;
IPAddress subnet;
IPAddress dns; // DNS-Server
IPAddress sdecondarDNS;
String hostname = "GROSSZEICHENDISPLAY2";
int status = WL_IDLE_STATUS;
const char* NTP_SERVER = "de.pool.ntp.org";
@ -133,8 +133,8 @@ const char* const PROGMEM DAY_NAMES[] = {"Sonntag", "Montag", "Dienstag", "Mittw
const char* const PROGMEM DAY_SHORT[] = {"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"};
//MQTT
//define mqtt_port 1883
const char* mqtt_server = "hjkmqtt.dedyn.io";
//define mqtt_port mqtt_port
//const char* mqtt_server = mqtt_server;
char topic_0[50];
char msg[20];
char clientName[30];
@ -660,6 +660,23 @@ static void setup_wifi() {
delay(10);
// We start by connecting to a WiFi network
if (!ip.fromString(MyIP)) { // try to parse into the IPAddress
Serial.println("UnParsable IP");
}
if (!dns.fromString(DNS)) { // try to parse into the IPAddress
Serial.println("UnParsable DNS");
}
if (!gateway.fromString(GATEWAY)) { // try to parse into the IPAddress
Serial.println("UnParsable GATEWAY");
}
if (!secondarDNS.fromString(SECONDARDNS)) { // try to parse into the IPAddress
Serial.println("UnParsable GATEWAY");
}
//WiFi.config( ip, dns, gateway, subnet );
if (!WiFi.config(ip, gateway, subnet, dns, secondarDNS))
{
Serial.println("STA Failed to configure");
}
Serial.println();
Serial.print("Connecting to ");
Serial.print(ssid);