Hi!
Any chance to make the ESP32 variant handle Long Range connections? (Hotspot & client.) — If it is not yet able, it might be an interesting function: essentially, it would ease IoT-development.
Hi!
Any chance to make the ESP32 variant handle Long Range connections? (Hotspot & client.) — If it is not yet able, it might be an interesting function: essentially, it would ease IoT-development.
Hi Aeneas,
Can you be more specific what you mean by Long Range?
Also, is this what you mean by hotspot?
Well, if you were to hook up two terminals on 1200-baud-connections each, each connected through pins 25 and 26 to an ESP32 like this one:
… then, when you turn on first the server, then the client, the two ESP32 will automatically connect wirelessly and whatever you type on one terminal will appear on the other (teletype style). I apologize if the code is rather rough, but I think the intention is clear. What is interesting is this parameter:
WIFI_PROTOCOL_LR
Other than that, thank you very much for showing me how to make an access point in uLisp, looks awesome and will come in very handy! :)
SERVER:
// Client: -- WHAT YOU NEED HERE
// telnet 192.168.4.1 8023
// or
// nc -C 192.168.4.1 8023
// (Server:
// nc -l -p 8023
// or
// busybox telnetd -p 8023)
// ESP8266: Serial0 was bitchy, Serial1 - D9 - is transmit only and worked:
// #define SRL Serial
#include <Arduino.h>
#include "WiFi.h"
#include <esp_wifi.h>
#include <SoftwareSerial.h>
char* ssid = "NETNAME";
const char* password = "SOMEPASSWORD";
WiFiServer wifiServer(8023);
WiFiClient client = wifiServer.available();
SoftwareSerial SRL(25,26);
// HardwareSerial SRL(2);
void setup() {
// start serial port
SRL.begin(1200);
// SRL.begin(1200, SERIAL_8N1, 16, 17); // rx, tx
WiFi.mode( WIFI_AP );
esp_wifi_set_protocol( WIFI_IF_AP, WIFI_PROTOCOL_LR );
WiFi.softAP(ssid, password);
delay(500);
// while (!SRL.available()) {}
SRL.print(" Establishing WiFi.");
wifiServer.begin();
SRL.print(" Net:NETNAME PW:SOMEPASSWORD");
SRL.print(" IP:");
SRL.print(WiFi.softAPIP());
SRL.println(" Port:8023");
int greeting = 1;
for (;;) {
client = wifiServer.available();
if (client) {
while (client.connected()) {
if (greeting == 1) {
greeting = 0;
client.print(F("\r\n SYSTEM ONLINE.\r\n"));
delay(50);
}
if (client.available()) {
char ch = static_cast<char>(client.read());
if ((ch > 96) && (ch < 123)) {ch = ch - 32;}
if (ch == '\n') {
SRL.print('\r');
}
SRL.print(ch);
delay(40); // 80
if (ch == '\n') {
delay(40); // 720 320
}
}
if (SRL.available()) {
char j = SRL.read();
if ((j > 96) && (j < 123)) {j = j - 32;}
// if (j != '\r') {
client.write(static_cast<char>(j));
SRL.print(j); // turn this on if localecho is needed - needed for netcat, NOT needed for telnetd
// }
}
}}}}
void loop() {}
CLIENT:
// (Client:
// telnet 192.168.4.1 8023
// or
// nc -C 192.168.4.1 8023)
// Server: - THIS IS WHAT YOU NEED HERE.
// nc -l -p 8023
// or
// busybox telnetd -p 8023
#include <Arduino.h>
#include "WiFi.h"
#include <esp_wifi.h>
#include <SoftwareSerial.h>
// ESP8266: Serial0 was bitchy, Serial1 - D9 - is transmit only and worked:
// #define SRL Serial
// HardwareSerial SRL(0);
SoftwareSerial SRL(25,26);
char* ssid = "NETNAME";
const char* password = "SOMEPASSWORD";
void setup() {
// start serial port
SRL.begin(1200);
//SRL.begin(1200, SERIAL_8N1, 16, 17); // rx, tx
WiFi.mode( WIFI_STA );
esp_wifi_set_protocol( WIFI_IF_STA, WIFI_PROTOCOL_LR );
WiFi.begin(ssid, password);
//while (!SRL.available()) {}
// ESP.wdtDisable();
while (WiFi.status() != WL_CONNECTED) {
delay(500);
// SRL.println("Connecting to WiFi..");
}
delay(500);
WiFiClient client;
int greeting = 1;
if (!client.connect(WiFi.gatewayIP(), 8023)) {return; }
for (;;) {
if (greeting == 1) {
greeting = 0;
client.print(F("\r\n SYSTEM ONLINE.\r\n"));
delay(50);
}
if (client.available()) {
char ch = static_cast<char>(client.read());
if ((ch > 96) && (ch < 123)) {ch = ch - 32;}
if (ch == '\n') {
SRL.print('\r');
}
SRL.print(ch);
delay(40); // 80
if (ch == '\n') {
delay(40); // 720 320
}
}
if (SRL.available()) {
char j = SRL.read();
if ((j > 96) && (j < 123)) {j = j - 32;}
// if (j != '\r') {
client.write(static_cast<char>(j));
SRL.print(j); // turn this on if localecho is needed - needed for netcat, NOT needed for telnetd
// }
}
}}
void loop() {}