Here is a web terminal, to "stay in touch" with an ESP, even when it is no longer connected to your computer.
Its use goes through the same functions as the Serial terminal : .print(), .available(), .read(), ...
Not very big, but of course bigger than a telnet library, because it also hosts client ressources (html, javascript, ...).
My lib might be easier to use : no need of telnet software on client-side.
Testing it is quite straight : just load example Full_Demo.ino and follow instructions.
I'm slightly surprised.
Nobody interested in replacing the standard Serial monitor by a web monitor, available natively on any browser (smartphone, etc.)?
It may be useful to keep a few prints in a program, for later verification of right behavior.
And combined with ArduinoOTA, you can easily work on a distant ESP without manipulating it.
Thank you for posting your library, this is great. I have been wanting a terminal like this for awhile and decided to do some googling again and found this post. I have run the full demo and it works very well.
One suggestion would be that whenever a screen is resized, it automatically forces on or locks out changes to autoscrolling. When using this on a phone and you click the text box your keyboard pops up, and it resizes the window. When this happens it has a way of tricking the screen into thinking you turned off auto scrolling because the window shrinks from bottom up and auto scrolling gets disabled. This happens as data is flying by and you phone keyboard opens up.
Right now I have been changing the demo into being used with an esp8266 in ap mode so it can host a wifi that any phone can easily connect to. I have it working, but would like to enable a captive portal to automatically load the page for the user when they connect. To do this, you can map the server.onNotFound( functionPointerHere ) to cause the loading of the web page. I am looking through your library and think a function built into the library to enable this would be awesome :-). Do you have a public function that would work for this?
esp8266 redirect examples
here is my code so far, requestNotFound needs to be replaced with a proper function to point to
//WiFiTerm full demo
//Please open Serial terminal and follow instructions
#include <ESP8266WiFi.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include "WiFiTerm.h"
ESP8266WebServer server(80);
#define DNS_PORT 53
IPAddress apIP(192, 168, 1, 1);
DNSServer dnsServer;
void setup()
{
Serial.begin(115200);
term.link(Serial); //optional : echo every print() on Serial
term.println("");
term.println("**************");
term.println("Program Start");
term.println("**************");
term.println("Welcome to WiFiTerm full demo example");
//******************************************************
// enable the wifi with the proper settings
WiFi.mode(WIFI_AP);
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
WiFi.softAP("ArduinoTerminal", "");
// if DNSServer is started with "*" for domain name, it will reply with
// provided IP to all DNS request
dnsServer.start(DNS_PORT, "*", apIP);
// replay to all requests with same HTML
server.onNotFound(requestNotFound);
server.begin();
term.begin(server);
//******************************************************
Serial.print("I'm waiting for you at http://");
Serial.print(WiFi.localIP());
Serial.println("/term.html");
//term.unlink(); //optional : stop echo on Serial
term.println("Welcome here");
term.println("Please note that previous lines were printed BEFORE WiFiTerm connection");
term.println("Now send me some text...");
}
void loop()
{
server.handleClient();
term.handleClient();
if (term.available())
{
term.print("Ok I received : ");
while (term.available()) //standard way
{
char c = term.read();
term.print(c);
}
term.println();
}
}
Hi there,
it's a while since I'm looking for having a wireless serial monitor to log numbers from my PID.
I ran an ESPduino, made a fresh new installation of arduino and ESP32.
I follwed you instructions, at compiling Webserver.h was missing
I tried with this: GitHub - zhouhan0126/WebServer-esp32: WebServer-esp32
It looks like your web server is not properly set.
loop() must often call server.handleClient()
Can you show your main program?
I don't really know what is an ESPDuino.
My lib is provided with examples for standard ESP32 and examples for standard ESP8266.
The first ones use standard lib <WebServer.h>, the seconde ones use standard lib <ESP8266WiFi.h>.
Both of them are provided by Arduino IDE, depending on target selection.
What did you chose in Arduino IDE ?
One possible reason is that rhe board was used for another project, where I flashed Espruino using this command:
esptool.py --port COM12 --baud 460800 write_flash --flash_size=detect 0x1000 bootloader.bin 0x10000 espruino_esp32.bin 0x8000 partitions_espruino.bin
Please forgive my ignorance.
Could it be the problem?
I tried erasing flash with esptool: esptool.py --chip esp32 erase_flash
Compiled and loaded both WiFiTerm and the STA example are not accessible by web browser.
Yes, flashing an hazardous bootloader might be the root cause of your problem, even if that does not explain why a standard lib is missing within your IDE.
I suggest to flash it again with a standard bootloader.
bricoleau:
Yes, flashing an hazardous bootloader might be the root cause of your problem, even if that does not explain why a standard lib is missing within your IDE.
I suggest to flash it again with a standard bootloader.
Hi there!
Well, it was something so simple that I felt bad and happy at the same time. The ESP32 was connected to the guest wi-fi network (while the laptop was in the main one).
It worked at the first attempt, as soon as the ESP32 was connected to the main wifi network.
Sorry for multiple questions and many thanks for your work with the terminal.