Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By somkoder
#28914 The library only initializes TCP and/or UDP listeners for you, but what to do with them is application dependent, so it does nothing about that.

Anyway, the point of this little library is to allow for quick setup of the operation mode, it does not try to do more than that.

You can find many TCP and UDP examples here and in other places, I'm sure you will find how to proceed from there, good luck!
User avatar
By MajorMadness
#29136 Hi, great lib and very useful! But I'm a bit stocked while trying to figure out how to implent it to an existing project.
Let's say I'm using the Basig Webserver Example HelloServer.ino from Example sketches and I want to:
1. load config from EEProm
2. Connect to Station
3. if fails start AP mode
4. if i go to 192.168.0.1 it should load whatever i wrote at server.on("/", handleRoot);
5. show config if i go to 192.168.0.1/config, update details and reset.

I can't figure out how to handle a diffrent request then showing the config page. Would be great if you can provide an other example / more informations.

Greetings
User avatar
By MajorMadness
#29166 Yes, I know but if you look into the lib example:
Code: Select all
// Initialize the system
void setup()
{
  pWebConfig = new WebConfig("BASIC WEBCONFIG v1.0", "ESP8266", "8266", false);
}// Serve HTTP configuration interface
void loop()
{
  pWebConfig->ProcessHTTP();
  yield();
}

Normally it's handled by server.handleClient();. Now, in this lib it's ProcessHTTP and this function directly builds the website and prints it:
(https://github.com/imerso/ESPWebConfig/ ... Config.cpp arround line 132)
Code: Select all   // response header
   String s;
.....
   // write second part of response
   httpClient.write(s.c_str(), s.length());
   httpClient.flush();


This is why I got confused. The only vfar I have is pWebConfig, no server, no function on();. This is why I asked for an explanation of how to setup a AP / Station which can handle multible sites.