Thanks to @me-no-dev's code. Lets Windows look up the PicoW by name using NBNS and needs much less memory and code than mDNS. AsyncUDP ported from the old ESP8266 version, only minimal changes. Will probably only be valid in IPv4 environments and may not match current ESP32 AsyncUDP interfaces.
38 lines
775 B
Arduino
38 lines
775 B
Arduino
// Modified from the ESP32-NetBIOS example
|
|
|
|
#include <WiFi.h>
|
|
#include <NetBIOS.h>
|
|
|
|
#ifndef STASSID
|
|
#define STASSID "your-ssid"
|
|
#define STAPSK "your-password"
|
|
#endif
|
|
|
|
const char* ssid = STASSID;
|
|
const char* password = STAPSK;
|
|
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
|
|
// Connect to WiFi network
|
|
WiFi.mode(WIFI_STA);
|
|
WiFi.begin(ssid, password);
|
|
Serial.println("");
|
|
|
|
// Wait for connection
|
|
while (WiFi.status() != WL_CONNECTED) {
|
|
delay(500);
|
|
Serial.print(".");
|
|
}
|
|
Serial.println("");
|
|
Serial.print("Connected to ");
|
|
Serial.println(ssid);
|
|
Serial.print("IP address: ");
|
|
Serial.println(WiFi.localIP());
|
|
|
|
// Windows (and other OSes using WINS/NetBIOS resolution should now be able to find the device by name)
|
|
NBNS.begin("PicoW");
|
|
}
|
|
|
|
void loop() {}
|