Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By shoelessone
#32447 An example might be something like I have pasted below. I realize not everybody would want this, but for me it would be nice to be able to add this without modifying your code (I realize it's only a single line, but just out of principle). Also, I think it would be ideal to be able to enable or disable the captive portal piece. For me that hasn't worked so well, or takes a really long time to "trigger". I think I'd prefer to just tell my family "type in 192.168.4.1" or whatever.

Thanks again!

Code: Select all<!DOCTYPE html><html>
<head>
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <title>Wifi Config</title>
   <link rel='stylesheet' href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>
   <div class="container">
   <h1>Wifi Configuration</h1>
   <p>Please choose a wifi network and enter a password (if required) below. Clicking "save" your device will restart. If you're having issues connecting reset your device and try again.</p>
   <form action="/wifi?" method="get">
     <div class="form-group">
       <label for="ssid">Email address</label>
       <select class="form-control" name="ssid" id="ssid">
         <option value="Wind-Up Bird Chronicles">Wind-Up Bird Chronicles</option>
         <option value="xfinity">xfinit</option>
         <option value="HOME-2CF8">HOME-2CF8</option>
      </select>
     </div>
     <div class="form-group">
       <label for="password">Password</label>
       <input type="password" class="form-control" id="password" name="password" placeholder="Password">
     </div>
     <button type="submit" class="btn btn-default">Submit</button>
   </form>
</html>


Here is the same thing, minified:

Code: Select all<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width, initial-scale=1"><title>Wifi Config</title><link rel='stylesheet' href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"></head><body><div class="container"><h1>Wifi Configuration</h1><p>Please choose a wifi network and enter a password (if required) below. Clicking "save" your device will restart. If you're having issues connecting reset your device and try again.</p><form action="/wifi?" method="get"> <div class="form-group"> <label for="ssid">Email address</label> <select class="form-control" name="ssid" id="ssid"><option value="Wind-Up Bird Chronicles">Wind-Up Bird Chronicles</option><option value="xfinity">xfinit</option><option value="HOME-2CF8">HOME-2CF8</option></select> </div><div class="form-group"> <label for="password">Password</label> <input type="password" class="form-control" id="password" name="password" placeholder="Password"> </div><button type="submit" class="btn btn-default">Submit</button></form></html>
User avatar
By alextu
#32452 hi, the captive portal doesn t disable the option of entering 192.168.4.1 manually. you can still go down that route.

on your html i see bootstrap cdn being loaded from the internet, which won t be possible really since you aren t connecte to wifi, so it would still look the same. the other change i noticed is you having a few preset ssid's.

is there anything i missed?
User avatar
By Dageso
#34191 Hi,
First of all thanks for the code but i have encounted a problem.
it is giving me this error:

WiFi connected
0.0.0.0
192.168.4.1
Error setting up MDNS responder!

the code does find the avaliable wifi networks but it stops at the MDNS responder
I have seen some one who had this issue but havent seen a solution if there is and i missed it sry about repost


Would appreciate any help


Thanks in advanced