Working with RNT’s tutorial RandomNerd_Access_Point_1.ino; the following code returned a value of 2??? How do I convert this response of 2 to a standerd notation; ie; 192.168.X.X
Serial.print(“WIFI_AP IP address: “);
Serial.println(WIFI_AP);
WIFI_AP IP address: 2?????
Hi.
I’m not sure why you got that value.
Did you select the right baud rate for the serial monitor?
Either way, the access point should be 192.168.4.1
Regards,
Sara
Thank you for your prompt response, much appreciated.
Yes, baud rate is set to115200.
What is a quick function to send a simple message from my Arduino/sketch/ESP32 module/server/access point to my iPhone/client/station to verify I do have a valid WiFi connection?
void loop ()
int cntr
Similiar as the following from an access point sketch utilizing communication from server to client:
WiFiClient client = server.available(); // listen for incoming clients
exit status 1
‘class AsyncWebServer’ has no member named ‘available’
void loop (){
int cntr;
client.print(cntr):
or
server.print(cntr);
cntr ++;
}
/*********
Rui Santos
Complete instructions at https://RandomNerdTutorials.com/build-web-servers-ebook/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*********/
#include <Arduino.h>
#include <WiFi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
// Replace with desired access point credentials
const char* ssid = “ESP32-Access-Point”;
const char* password = “123456789”;
int cntr;
// Create AsyncWebServer object on port 80
AsyncWebServer server(80);
const char index_html[] PROGMEM = R”rawliteral(
<!DOCTYPE html>
<html>
<head>
<title>ESP Web Server</title>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<link rel=”icon” href=”data:,”>
<style>
html {
font-family: Arial;
text-align: center;
}
body {
max-width: 400px;
margin:0px auto;
}
</style>
</head>
<body>
<h1>Hello World!</h1>
<p>Congratulations!<br>This is your first Web Server with the ESP.</p>
</body>
</html>
)rawliteral”;
void initAP() {
WiFi.mode(WIFI_AP);
WiFi.softAP(ssid, password);
}
void setup() {
// Serial port for debugging purposes
Serial.begin(115200);
Serial.println(“RandomNerd_Access_Point_1.ino”);
Serial.println(“03/26/2023”);
Serial.print(“ESP32 Module: “);
Serial.println(“TTGO T7 V1.3 Mini32”);
initAP();
Serial.print(“WIFI ssid: “);
Serial.println(ssid);
Serial.print(“WIFI password: “);
Serial.println(password);
Serial.print(“WIFI_AP IP address: “);
Serial.println(WIFI_AP);
server.on(“/”, HTTP_GET, [](AsyncWebServerRequest *request){
request->send(200, “text/html”, index_html);
// client.print(“HTTP/1.1 200 OK”);
});
// Start server
server.begin();
Serial.println(“server.begin();”);
cntr = 0;
}
void loop() {
WiFiClient client = server.available(); // listen for incoming clients
server.print(“HTTP/1.1 200 OK”);
// server.print(“cntr = “);//client.print(cntr);
// server.print(cntr);
cntr ++;
// Serial.println(“Hello World”);
// put your main code here, to run repeatedly:
}
Is there a means to attach items to these text boxes, shuch as complete sketches, etc?
Found this simple_server.ini on Github, regarding retrieving a Web-site ;
Serial.print(“IP Address #2: “);//added from Github/me-no-dev/ESPAsyncWebServer/simple_server.ino
Serial.println(WiFi.localIP());//added from Github/me-no-dev/ESPAsyncWebServer/simple_server.ino
11:33:28.004 -> RandomNerd_Access_Point_1.ino
11:33:28.004 -> 03/28/2023
11:33:28.004 -> ESP32 Module: TTGO T7 V1.3 Mini32
11:33:28.139 -> WIFI ssid: ESP32-Access-Point
11:33:28.139 -> WIFI password: 123456789
11:33:28.139 -> WIFI_AP IP address #1: 2
11:33:28.139 -> IP Address #2: 0.0.0.0
11:33:28.172 -> server.begin();
What do you think, if IP Adress returns 0.0.0.0; does that mean I have not established a Web-page via the ESP32 module?
How do i utilize the Insert/edit imiage button to insert an imamge in the text box?
Hi.
Have you tried this example: https://randomnerdtutorials.com/esp32-access-point-ap-web-server/??
What is exactly the project you’re following?
To share a code upload it to github or pastebin and then share a link to the resource.
Regards,
Sara