Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By NailBuster
#40504 I'm using this library as an easy starting/base library for working on the esp8266... myWebServer will serve files from the SPIFFs on your device. (You should only use this on devices with available spiffs! (4MB on nodemcu for example)).

features:

It will try and connect to your AcessPoint, if not config/connect it will auto-start local AP like "myespxxxx". You just connect to that AP with your phone/tablet and it will display Wifi connect configuration. (Uses captive DNS so you can just go to browser and type setup.com or "anything".com). restart nodemcu after you've configured connection....

Afterwards once the device connects to your local router/internet. You go to it's local lan IP, or if your system supports mDNS you can type http://"device_name".local on your browser(device name is from setup from above).

"Virgin" configs will bring up an integrated HTML file browser. You can upload multiple files or drag files to top to allow your webserver to work...(index.html...etc). Copy the sample html files into server to test out some features...

supports OTA updating of ESP device via Wifi.

ntp time support with some methods to easily grab current date/time.

see sample htmls in folder for other features.... if you look at the couldgen.html file you'll see how by just using the html the form is saved into a json file. So you can add a new form field and it will automatically be saved/loaded in the json file...without changing the server, really flexible to get/set new settings.

this is still a WIP but I'll be updating as needed....I have other features I want to implement as well....

source for project : https://github.com/nailbuster/myWebServer

Also I created a version with Async webserver library: Different but more stable with many web requests.

The Async version is here: https://github.com/nailbuster/myWebServerAsync
Last edited by NailBuster on Thu Feb 23, 2017 7:59 pm, edited 1 time in total.
User avatar
By Manti
#40690 I get the following,
All libs should be installed...

Code: Select all
sketch\myWebServer.cpp: In function 'bool isAdmin()':

sketch\myWebServer.cpp:196:14: error: 'class ESP8266WebServer' has no member named 'authenticate'

  if (!server.authenticate(ConfigUsername.c_str(), ConfigPassword.c_str()))

              ^

sketch\myWebServer.cpp:198:10: error: 'class ESP8266WebServer' has no member named 'requestAuthentication'

   server.requestAuthentication();

          ^

sketch\myWebServer.cpp: In member function 'void MyWebServerClass::begin()':

sketch\myWebServer.cpp:660:7: error: 'class ESP8266WiFiClass' has no member named 'setAutoReconnect'

  WiFi.setAutoReconnect(true);