Yorick GEOFFRE 2 years ago
parent 1578d96a1f
commit 50287f1baa

@ -1,15 +1,17 @@
#include "webserver.h" #include "webserver.h"
#define CHECK_FOR_AP_EXISTS
#undef CHECK_FOR_AP_EXISTS //commentez cette ligne pour activer la vérificationque l'AP existe (peut être buggé)
WebServer webServer(Serial1, Serial); WebServer webServer(Serial1, Serial);
void setup() { void setup() {
Serial1.setTX(12); Serial1.setTX(12); //uniquement applicable au RP2040 (pas au UNO)
Serial1.setRX(13); Serial1.setRX(13);
Serial1.begin(115200); Serial1.begin(115200);
Serial.begin(115200); Serial.begin(115200);
delay(2000); delay(2000);
webServer.setup("tmk2", "tk666666"); webServer.setup("ssid", "mot de passe");
String localIP = webServer.getLocalIP(); String localIP = webServer.getLocalIP();
if (localIP.length() > 0) { if (localIP.length() > 0) {

@ -51,11 +51,12 @@ class WebServer {
void setup(const char* ssid, const char* password) { void setup(const char* ssid, const char* password) {
debugSerial.println("Setting up web server..."); debugSerial.println("Setting up web server...");
#ifdef CHECK_FOR_AP_EXISTS
if (!findAP(ssid)) { if (!findAP(ssid)) {
debugSerial.println("The specified AP could not be found. Please check the SSID and try again."); debugSerial.println("The specified AP could not be found. Please check the SSID and try again.");
return; return;
} }
#endif
atSerial.println("AT+CWMODE=3"); atSerial.println("AT+CWMODE=3");
delay(1000); delay(1000);

Loading…
Cancel
Save