Keyestudio ESP32 Manual page 152

Smart robot arm kit
Hide thumbs Also See for ESP32:
Table of Contents

Advertisement

keyestudio WiKi
Once Wi-Fi is connected, ESP32's Web server will serve up web pages. In the following example, we will create a
simple web page that says "Hello, World!" :
/*
Keyestudio ESP32 Robot Arm
9-4-2-2 tutorial code
Function: Conenct to WiFi and print esp32 IP address, set up a web page saying
World"
http://www.keyestudio.com
*/
#include
<WiFi.h>
#include
<WebServer.h>
/*ATTENTION:
ESP32 only supports wifi at a frequency of 2.4GHz.
If wifi fails to be connected, please check wifi name, passwords and frequency.
Modify "your_SSID " into your wifi name
Modify "your_PASSWORD" into your wifi passwords*/
const
char*
ssid
=
const
char*
password
WiFiServer server(80);
to access the web page without entering the port number.
void
setup() {
Serial.begin(9600);
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to
Serial.println(ssid);
WiFi.begin(ssid, password);
while
(WiFi.status()
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi
// Start the server
server.begin();
Serial.println("Server
// Print the IP address
Serial.print("IP Address:
Serial.println(WiFi.localIP());
}
void
loop() {
WiFiClient client
WiFi server and assign it to a WiFiClient object named client
if
(!client) {
the connection from the client was successfully accepted. If not, exit
immediately
148
"your_SSID";
=
"your_PASSWORD";
//Set the web port to 80. You can directly enter the IP
");
!=
WL_CONNECTED) {
connected.");
started");
");
=
server.available();
//Try to accept a request coming in from
//This conditional statement checks
Chapter 9. 9. Robot Arm Projects
"Hello␣
address␣
the␣
whether␣
execution␣
(continues on next page)

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

Subscribe to Our Youtube Channel

Related Products for Keyestudio ESP32

Table of Contents