I'm using ESP8266's to create four time controlled switches.
When they try to get an ntpServer address using WiFi.hostByName(),
three of the IPAddresses I want to use for the devices return
a time server address, but the fourth fails with "us.pool.ntp.org: (IP unset)".
What do I need to do to make the fourth address succeed?
These are the addresses I'm sending to the ntp address servers:
hostIP(192, 168, 1, 241) succeeds
hostIP(192, 168, 1, 242) succeeds
hostIP(192, 168, 1, 243) *fails
hostIP(192, 168, 1, 244) succeeds
I would appreciate any thoughts.
<
This is the simplified code:
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <stdio.h>
#include <string.h>
void setup()
{
Serial.begin(115200);
while(!Serial);
WiFiUDP Udp;
WiFiServer server(80);
Serial.print("\nConnecting to ");
Serial.println(ssid);
WiFi.hostname("ESP8266_243");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
WiFi.config(IPAddress(192, 168, 1, 243),
IPAddress(192, 168, 1, 1),
IPAddress(255, 255, 255, 0));
Serial.println("\nWiFi connected.");
Udp.begin(4333);
IPAddress ntpServerIP; // NTP server's ip address
Serial.println("\nTransmit NTP Request");
WiFi.hostByName("us.pool.ntp.org", ntpServerIP);
Serial.println(ntpServerIP);
} //Setup
void loop()
{
Serial.println("Loop");
delay(1000);
} // loop
Note: sorry the code section isn't in code format, but I couldn't find a way to delete it and start over.