Hi All,
I have a small webserver project that I'm working on where I want it to connect to a wireless network (I will have the ssid and password in advance) and then it's accessible by hostname from a computer on the same network.
I'm using a wemos D1 mini. Here's my sample code for the webserver. I've put some stuff on the same lines to save reading space:
#include <ESP8266WiFi.h> #include <WiFiClient.h>
#include <ESP8266WebServer.h> #include <ESP8266mDNS.h>
// network credentials
const char* ssid = "sside_name"; const char* password = "eifi_pass";
String webPage = "<h1>Wemos testing</h1>";
ESP8266WebServer server(80);
void setup()
{
Serial.begin(115200);
delay(500);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.println(".");
}
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
server.on ("/", [](){server.send(200, "text/html", webPage);});
server.begin();
Serial.println("HTTP server started");
}
void loop()
{ server.handleClient(); }
I've read about the bonjour service and want to know about if this will be compatible with recent smart phones, windows and apple PC's.
I've done some research on this page, but I'm new enough to coding that I can't write from scratch and need help modifying existing code to suit my needs: http://gkaindl.com/software/arduino-ethernet/bonjour
Thank you for any and all help you can offer.
Nubstar