Open
Description
Please see the attached sketch which reproduces the issue. This is the output with and without a manual DNS address:
// With default/GW DNS address.
00:37:09.929 -> Attempting to connect to SSID: ***
00:37:22.549 -> Connected to WiFi
00:37:22.615 -> IP Address: 142.251.37.196
// With manual DNS address.
00:36:10.968 -> Attempting to connect to SSID: ***
00:36:23.673 -> Connected to WiFi
00:36:23.673 -> Setting DNS address
00:36:30.672 -> IP Address: 0.0.0.0
Sketch:
#include <SPI.h>
#include <WiFiNINA.h>
#include "arduino_secrets.h"
char ssid[] = SECRET_SSID; // your network SSID (name)
char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
WiFiClient client;
int status = WL_IDLE_STATUS;
char server[] = "www.google.com"; // name address for Google (using DNS)
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// check for the WiFi module:
if (WiFi.status() == WL_NO_MODULE) {
Serial.println("Communication with WiFi module failed!");
// don't continue
while (true);
}
String fv = WiFi.firmwareVersion();
if (fv < WIFI_FIRMWARE_LATEST_VERSION) {
Serial.println("Please upgrade the firmware");
}
// attempt to connect to WiFi network:
while (status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}
Serial.println("Connected to WiFi");
Serial.println("Setting DNS address");
WiFi.config(IPAddress(192, 168, 1, 200), IPAddress(8, 8, 8, 8));
IPAddress host_ip;
WiFi.hostByName("www.google.com", host_ip);
Serial.print("IP Address: ");
Serial.println(host_ip);
}
void loop() {
// do nothing forevermore:
while (true);
}
Metadata
Metadata
Assignees
Labels
No labels