EasyManuals Logo

Freenove ESP32-S3 User Manual

Default Icon
142 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #92 background imageLoading...
Page #92 background image
Any concerns? support@freenove.com
Chapter 6 TCP/IP
90
www.freenove.com
42
43
44
45
46
47
48
49
50
51
52
}
if (Serial.available() > 0) {
delay(20);
String line = Serial.readString();
client.print(line);
}
if (client.connected () == 0) {
client.stop();
WiFi.disconnect();
}
}
Add WiFi function header file.
1
#include <WiFi.h>
Enter the actual router name, password, remote server IP address, and port number.
3
4
5
6
const char *ssid_Router = "********"; //Enter the router name
const char *password_Router = "********"; //Enter the router password
#define REMOTE_IP "********" //input the remote server which is you want to connect
#define REMOTE_PORT 8888 //input the remote port which is the remote provide
Apply for the method class of WiFiClient.
7
WiFiClient client;
Connect specified WiFi until it is successful. If the name and password of WiFi are correct but it still fails to
connect, please push the reset key.
13
14
15
16
17
18
WiFi.begin(ssid_Router, password_Router);
Serial.print("\nWaiting for WiFi... ");
while (WiFi.status() ! = WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Send connection request to remote server until connect successfully. When connect successfully, print out the
connecting prompt on the serial monitor and send messages to remote server.
28
29
30
31
32
33
while (!client.connect(REMOTE_IP, REMOTE_PORT)) {//Connect to Server
Serial.println("Connection failed.");
Serial.println("Waiting a moment before retrying...");
}
Serial.println("Connected");
client.print("Hello\n");
When ESP32-S3 receive messages from servers, it will print them out via serial port; Users can also send
messages to servers from serial port.
37
38
39
40
41
42
if (client.available() > 0) {
delay(20);
//read back one line from the server
String line = client.readString();
Serial.println(REMOTE_IP + String(":") + line);
}

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Freenove ESP32-S3 and is the answer not in the manual?

Freenove ESP32-S3 Specifications

General IconGeneral
BrandFreenove
ModelESP32-S3
CategoryControl Unit
LanguageEnglish