Probably that question was asked. I couldn’t find what I was looking for.
In desperation, that’s what I’ve done, which works perfectly, but I have a very specific point.
I first looked for wifimanager. Ok, there are some, but many are bugged, do not work properly or request third-party libraries not compatible with my configuration.
This brings me to the configuration, precisely. Here, an ESP32-C3, with a compilation made on VSC PlatformIO and the Arduino environment. Much simpler for me, casual programmer.
I try above all to send a form (ok), and also to process the return information of this form. For example, pressing the "sent" button will return the fields to me as a POST method. That’s exactly what I can’t do. Perhaps you could help me.
A little code, certainly to show what I did:
platform.ini
Code: Select all
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:esp32-c3-devkitm-1]
platform = espressif32
board = esp32-c3-devkitm-1
framework = arduino
build_flags =
-DARDUINO_USB_MODE=1
-DARDUINO_USB_CDC_ON_BOOT=1
Code: Select all
/**
* MyProject
*
* This is the Myproject configuration system.
*
* Version : 1.0.0
* */
// GOIO REEL
#define IO0 0
#define IO1 1
#define IO2 2
#define IO3 3
#define IO4 4
#define IO5 5
#define IO6 6
#define IO7 7
#define IO8 8
#define IO9 9 // Boot / Led for default
#define IO10 10
Code: Select all
#include <Arduino.h>
#include <WiFi.h>
#include "MY.h"
#define LED IO10
const char*Wifi_ssid = "exa"; // SSID of your Router OR mobile hotspot
const char*Wifi_password = "Wel@In"; // PASSWORD of your Router or Mobile hotspot see below example
const char *Apssid = "MY_AP_CONFIG"; // give Accesspoint SSID, your esp's hotspot name
const char *Appassword = "my@essay"; // password of your esp's hotspot
const uint8_t ipPort = 80; // Port du serveur web
String page;
Preferences prefs;
WiFiServer server(80);
void setup() {
pinMode(LED, OUTPUT);
digitalWrite(LED, LOW);
Serial.begin(9600);
WiFi.mode(WIFI_AP_STA); // changing ESP9266 wifi mode to AP + STATION
WiFi.softAP(Apssid, Appassword); //Starting AccessPoint on given credential
server.begin();
/*
// Connexion au routeur, si infos OK
WiFi.begin(Wifi_ssid, Wifi_password); // to tell Esp32 Where to connect and trying to connect
while (WiFi.status() != WL_CONNECTED) { // While loop for checking Internet Connected or not
delay(300);
digitalWrite(LED, HIGH);
delay(200);
digitalWrite(LED, LOW);
//Serial.print(".");
}
Serial.println("Config OK");
*/
}
void loop() {
WiFiClient client = server.available();
if (client) {
String currentLine = "";
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (c == '\n') {
if (currentLine.length() == 0) {
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println();
client.println("<html>");
client.println("<head>");
client.println("<title>Test MY</title>");
client.println("<style>");
client.println("body{font-size: 40px;}");
client.println("form{font-size: 40px;}");
client.println("</style>");
client.println("</head>");
client.println("<body>");
client.println("<p>MY Test !</p>");
client.println("<form method='POST'>");
client.println("<input type='text' name='myvalue' value='myvalue'>");
client.println("<input type='submit' name='save' value='Save'>");
client.println("</form>");
client.println("</body>");
client.println("</html>");
client.println();
break;
}
else {
currentLine = "";
}
}
else if(c != '\r') {
currentLine += c;
}
}
}
client.stop();
}
}
If, by chance, someone could point me to a solution, a functional library that my current core has redesigned, I’m willing to give it a try.
Thank you very much for your attention.