Make webserver using ESP8266_Lib.h

hello guys, i have project using UNO and ESP01, and i want make some webserver (for change ssid and pwd) using ESP8266_Lib.h, i am already done create softAP, but i am confuse reading wich class for make webserver, i search using google and read example fromTCPClientSingle.ino, some class same with ESP8266_Lib.h, but for i get problem for receive data (wifi.recvString), i hope i can get some light for my project, here for my code

//#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <EEPROM.h>
#include <EEPROMAnything.h>
#include <SoftwareSerial.h>

#define ESP8266_BAUD 9600
#define HOST_NAME   "192.168.1.1"
#define HOST_PORT   (80)

SoftwareSerial EspSerial(13,12); // RX | TX
ESP8266 wifi(&EspSerial);


char auth[] = "token"; //token dari blynk
char ssid[] = "ssid";                            // nama akses point
char pass[] = "pwd";                         // password akses point
char ssidAP[] = "ssidAP";                            // nama akses point
char passAP[] = "pwdAP"; 
char ipAP[]="192.168.4.1";

bool wifistat,blynkstat;
String target;

//struct config_t
//{
  
//} cfg;




void setup()
{
  // Debug console
  Serial.begin(9600);

  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);

  Serial.println (F("Perangkat menyala...\n")); delay(1000);

  
  Serial.print(F("menghubungkan ke SSID: "));
  Serial.println(ssid);

  //Blynk.begin(auth, wifi, ssid, pass);
  
  //wifi.joinAP(ssid, pass);
  if (wifi.joinAP(ssid, pass)){
    Serial.print (F("\nBerhasil terhubung ke SSID "));Serial.println(ssid); delay(2000);
    wifistat = true; Blynk.config(wifi,auth);
    if(Blynk.connect()){
      Serial.println(F("Berhasil terhubung ke Blynk ")); blynkstat = true;
    } else {
      Serial.println(F("Gagal terhubung ke Blynk ")); blynkstat = false;
    }  
  } else {
    Serial.print (F("\nGagal terhubung ke SSID "));Serial.println(ssid); delay(2000);
    Serial.println(F("\nMemulai Mode Portal konfigurasi WiFi"));
    wifistat = false; ModeAP();
  }
  
}

void ModeAP(){
  if (wifi.setOprToSoftAP()){
    Serial.println (F("\nMode Portal konfigurasi WiFi berhasil"));
    wifi.setSoftAPParam(ssidAP, passAP);
    if (wifi.disableMUX()) {
        Serial.print("single ok\r\n");
    } else {
        Serial.print("single err\r\n");
    }
    wifi.startTCPServer(8090);
  } else {
    Serial.println (F("\nMode Portal konfigurasi WiFi gagal"));
  } 
  
}

void loop()
{
  if (wifistat==true || blynkstat==true){
    Blynk.run(); 
  }
  
}

void servertes(){
  
    
    uint8_t buffer[1024] = {0};

    if (wifi.createTCP(HOST_NAME, HOST_PORT)) {
        Serial.print("create tcp ok\r\n");
    } else {
        Serial.print("create tcp err\r\n");
    }
    char *hello = "GET / HTTP/1.1\r\nHost: www.baidu.com\r\nConnection: close\r\n\r\n";
    //~ char *hello = "GET / HTTP/1.1\r\nHost: 192.168.0.100:8085\r\nConnection: close\r\n\r\n";
    wifi.send((const uint8_t*)hello, strlen(hello));

    String wifi.recvString(target, 1000);

    
    if (wifi.releaseTCP()) {
        Serial.print("release tcp ok\r\n");
    } else {
        Serial.print("release tcp err\r\n");
    }
}

What is the use case for this?

Also not sure this is a Blynk related support question. If you’re just after general help to do with ESP8266_Lib.h then you’re on the wrong forums.

Take a look at WiFi Manager. Not sure if this would work for an ESP8266 linked to an UNO, but it certainly works great on a standalone ESP8266 or NodeMCU.

Pete.

Halo @Jamin, i want if some time i go to different place with different router, if i cant connect to wifi and blynk, then arduino will go to AP mode to make webpage, so from the web page i can change ssid and pass and save it to eeprom, i use library esp8266_Lib.h and blynksimpleshieldesp8266.h because its used in sketch for arduino uno with esp shield, in esp8266_lib.h i think this library can make softAP and make tcpserver, but i cannot find how to make it for send/recieve because i dont get some example for me to learn how to use this library(because this is conected with blynksimpleshieldesp8266.h for run blynk)

Yes this wifimanager is working great if esp running standalone, i will check if this library can give me some clue for make wifi config esp hooked on arduino uno. Maybe some one have same problem problem with me and find how to solved this :slight_smile: