

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF[
	<!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
	<!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
	<!ENTITY owl 'http://www.w3.org/2002/07/owl#'>
	<!ENTITY swivt 'http://semantic-mediawiki.org/swivt/1.0#'>
	<!ENTITY wiki 'http://https://wikifab.org/wiki/Special:URIResolver/'>
	<!ENTITY category 'http://https://wikifab.org/wiki/Special:URIResolver/Category-3A'>
	<!ENTITY property 'http://https://wikifab.org/wiki/Special:URIResolver/Property-3A'>
	<!ENTITY wikiurl 'https://wikifab.org/wiki/'>
]>

<rdf:RDF
	xmlns:rdf="&rdf;"
	xmlns:rdfs="&rdfs;"
	xmlns:owl ="&owl;"
	xmlns:swivt="&swivt;"
	xmlns:wiki="&wiki;"
	xmlns:category="&category;"
	xmlns:property="&property;">

	<owl:Ontology rdf:about="https://wikifab.org/wiki/Special:ExportRDF/Led_Control_with_ESP_Webserver">
		<swivt:creationDate rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2026-04-04T06:10:36+02:00</swivt:creationDate>
		<owl:imports rdf:resource="http://semantic-mediawiki.org/swivt/1.0"/>
	</owl:Ontology>
	<swivt:Subject rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Led_Control_with_ESP_Webserver">
		<rdf:type rdf:resource="http://https://wikifab.org/wiki/Special:URIResolver/Category-3ATutorials"/>
		<rdfs:label>Led Control with ESP Webserver</rdfs:label>
		<rdfs:isDefinedBy rdf:resource="https://wikifab.org/wiki/Special:ExportRDF/Led_Control_with_ESP_Webserver"/>
		<swivt:page rdf:resource="https://wikifab.org/wiki/Led_Control_with_ESP_Webserver"/>
		<swivt:wikiNamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">0</swivt:wikiNamespace>
		<swivt:wikiPageContentLanguage rdf:datatype="http://www.w3.org/2001/XMLSchema#string">en</swivt:wikiPageContentLanguage>
		<property:Area rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Electronics</property:Area>
		<property:Complete rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Published</property:Complete>
		<property:Cost rdf:datatype="http://www.w3.org/2001/XMLSchema#double">15</property:Cost>
		<property:Currency rdf:datatype="http://www.w3.org/2001/XMLSchema#string">USD ($)</property:Currency>
		<property:Description rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Will guide you to build a simple web control LED unit.</property:Description>
		<property:Difficulty rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Easy</property:Difficulty>
		<property:Duration rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1</property:Duration>
		<property:Duration-2Dtype rdf:datatype="http://www.w3.org/2001/XMLSchema#string">hour(s)</property:Duration-2Dtype>
		<property:Introduction rdf:datatype="http://www.w3.org/2001/XMLSchema#string">In this tutorial, you will learn how to create a web server with ESP32 that can control an LED from any device connected to the same WiFi network. You will use the Arduino IDE to program the ESP32 and the web browser to access the web server.</property:Introduction>
		<property:IsTranslation rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</property:IsTranslation>
		<property:Language rdf:datatype="http://www.w3.org/2001/XMLSchema#string">en</property:Language>
		<property:Licences rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Attribution (CC BY)</property:Licences>
		<property:Main_Picture rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Led_Control_with_ESP_Webserver_1.JPG</property:Main_Picture>
		<property:SourceLanguage rdf:datatype="http://www.w3.org/2001/XMLSchema#string">none</property:SourceLanguage>
		<property:Step_Content rdf:datatype="http://www.w3.org/2001/XMLSchema#string">To follow this tutorial, you need the following components:

* An ESP32 development board
* A USB cable to connect the ESP32 to the computer
* The Arduino IDE installed on your computer
* The ESP32 add-on for the Arduino IDE</property:Step_Content>
		<property:Step_Content rdf:datatype="http://www.w3.org/2001/XMLSchema#string">You must check out [https://www.pcbway.com/ PCBWAY] for ordering PCBs online for cheap!

You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto [https://www.pcbway.com/ PCBWAY] to get them manufactured with good quality and quick turnaround time. PCBWay now could provide a complete product solution, from design to enclosure production. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop. Also, check out this useful blog on PCBWay Plugin for KiCad from [https://www.pcbway.com/blog/News/PCBWay_Plug_In_for_KiCad_3ea6219c.html here.] Using this plugin, you can directly order PCBs in just one click after completing your design in KiCad.</property:Step_Content>
		<property:Step_Content rdf:datatype="http://www.w3.org/2001/XMLSchema#string">The ESP32 will act as a web server that can serve HTML and CSS files to web clients (such as web browsers or smartphones). The web page will have a button that can send an HTTP request to the ESP32 to turn the LED on or off.

The ESP32 will also handle the HTTP requests from the web clients and respond accordingly. For example, if the ESP32 receives a request to turn the LED on, it will set the GPIO pin connected to the LED to HIGH and send back a confirmation message.</property:Step_Content>
		<property:Step_Content rdf:datatype="http://www.w3.org/2001/XMLSchema#string">&lt;nowiki&gt;The code for the ESP32 is also straightforward. You need to include the WiFi.h and ESPAsyncWebServer.h libraries, which are used to connect the ESP32 to the WiFi network and to create the web server.&lt;br /&gt;&lt;br /&gt;You also need to define the WiFi credentials, the GPIO pin for the LED, and the web server object. Then, you need to create a function to generate the HTML and CSS code for the web page, which will have a button to toggle the LED state.&lt;br /&gt;&lt;br /&gt;Next, you need to create a function to connect the ESP32 to the WiFi network and print the IP address to the serial monitor. You also need to create a function to handle the HTTP requests from the web clients and change the LED state accordingly.&lt;br /&gt;&lt;br /&gt;Finally, you need to initialize the LED pin, the WiFi connection, and the web server in the setup() function, and keep the web server running in the loop() function.&lt;br /&gt;&lt;br /&gt;The complete code is shown below:&lt;div class="mw-highlight mw-content-ltr" dir="ltr"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&lt;WiFi.h&gt;&lt;/span&gt;&lt;span class="cp"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&lt;ESPAsyncWebServer.h&gt;&lt;/span&gt;&lt;span class="cp"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="c1"&gt;// WiFi credentials&lt;/span&gt;&lt;br /&gt;&lt;span class="cp"&gt;#define WIFI_SSID "Your WiFi SSID"&lt;/span&gt;&lt;br /&gt;&lt;span class="cp"&gt;#define WIFI_PASSWORD "Your WiFi Password"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="c1"&gt;// LED pin&lt;/span&gt;&lt;br /&gt;&lt;span class="cp"&gt;#define LED_PIN&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="c1"&gt;// Web server object&lt;/span&gt;&lt;br /&gt;&lt;span class="n"&gt;AsyncWebServer&lt;/span&gt; &lt;span class="nf"&gt;server&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="c1"&gt;// LED state&lt;/span&gt;&lt;br /&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;LED_state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;LOW&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="c1"&gt;// Function to generate the HTML and CSS code for the web page&lt;/span&gt;&lt;br /&gt;&lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;getHTML&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"&lt;!DOCTYPE HTML&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"&lt;html&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"&lt;head&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"&lt;style&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"body {background-color: #F0F0F0; font-family: Arial, Helvetica, sans-serif;}"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"h1 {color: #333333; text-align: center;}"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"button {width: 150px; height: 50px; font-size: 20px; margin: 10px;}"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"&lt;/style&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"&lt;/head&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"&lt;body&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"&lt;h1&gt;ESP32 Web Server&lt;/h1&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"&lt;p&gt;LED state: &lt;span style='color: red;'&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;LED_state&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;LOW&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"OFF"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"ON"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"&lt;/span&gt;&lt;/p&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"&lt;button onclick=&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s"&gt;window.location.href='/led/on'&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s"&gt;&gt;Turn ON&lt;/button&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"&lt;button onclick=&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s"&gt;window.location.href='/led/off'&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s"&gt;&gt;Turn OFF&lt;/button&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"&lt;/body&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s"&gt;"&lt;/html&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;html&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="c1"&gt;// Function to connect to WiFi network&lt;/span&gt;&lt;br /&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;connectWiFi&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;Serial&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Connecting to WiFi..."&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;WiFi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;begin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;WIFI_SSID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;WIFI_PASSWORD&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;  &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;WiFi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;WL_CONNECTED&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class="n"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;    &lt;span class="n"&gt;Serial&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"."&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;  &lt;span class="p"&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;Serial&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;println&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;Serial&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"WiFi connected"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;Serial&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"IP address: "&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;Serial&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;WiFi&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;localIP&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;&lt;br /&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="c1"&gt;// Function to handle HTTP requests&lt;/span&gt;&lt;br /&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;handleRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;AsyncWebServerRequest&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class="c1"&gt;// Get the request path&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="o"&gt;-&gt;&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;br /&gt;  &lt;span class="c1"&gt;// Check if the request is to turn the LED on&lt;/span&gt;&lt;br /&gt;  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"/led/on"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class="c1"&gt;// Set the LED pin to HIGH&lt;/span&gt;&lt;br /&gt;    &lt;span class="n"&gt;digitalWrite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;LED_PIN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;HIGH&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;    &lt;span class="c1"&gt;// Update the LED state&lt;/span&gt;&lt;br /&gt;    &lt;span class="n"&gt;LED_state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;HIGH&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class="c1"&gt;// Send a confirmation message&lt;/span&gt;&lt;br /&gt;    &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="o"&gt;-&gt;&lt;/span&gt;&lt;span class="n"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"text/plain"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"LED turned on"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;  &lt;span class="p"&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class="c1"&gt;// Check if the request is to turn the LED off&lt;/span&gt;&lt;br /&gt;  &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"/led/off"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class="c1"&gt;// Set the LED pin to LOW&lt;/span&gt;&lt;br /&gt;    &lt;span class="n"&gt;digitalWrite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;LED_PIN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;LOW&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;    &lt;span class="c1"&gt;// Update the LED state&lt;/span&gt;&lt;br /&gt;    &lt;span class="n"&gt;LED_state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;LOW&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;br /&gt;    &lt;span class="c1"&gt;// Send a confirmation message&lt;/span&gt;&lt;br /&gt;    &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="o"&gt;-&gt;&lt;/span&gt;&lt;span class="n"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"text/plain"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"LED turned off"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;  &lt;span class="p"&gt;}&lt;/span&gt;&lt;br /&gt;  &lt;span class="c1"&gt;// Otherwise, send the web page&lt;/span&gt;&lt;br /&gt;  &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span class="c1"&gt;// Get the HTML and CSS code&lt;/span&gt;&lt;br /&gt;    &lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;getHTML&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;br /&gt;    &lt;span class="c1"&gt;// Send the web page&lt;/span&gt;&lt;br /&gt;    &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="o"&gt;-&gt;&lt;/span&gt;&lt;span class="n"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"text/html"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;html&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;  &lt;span class="p"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setup&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class="c1"&gt;// Initialize the serial monitor&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;Serial&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;begin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;115200&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class="c1"&gt;// Initialize the LED pin&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;pinMode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;LED_PIN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;OUTPUT&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;digitalWrite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;LED_PIN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;LED_state&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class="c1"&gt;// Connect to WiFi network&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;connectWiFi&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class="c1"&gt;// Start the web server&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;onNotFound&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;handleRequest&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;&lt;br /&gt;  &lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;begin&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;br /&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;loop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;br /&gt;  &lt;span class="c1"&gt;// Nothing to do here&lt;/span&gt;&lt;br /&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/nowiki&gt;</property:Step_Content>
		<property:Step_Content rdf:datatype="http://www.w3.org/2001/XMLSchema#string">To test the web server, you need to upload the code to the ESP32 board and open the serial monitor. You should see the IP address of the ESP32, which is something like 192.168.1.8

Then, you need to open a web browser on your computer or smartphone and enter the IP address of the ESP32. You should see the web page with the button to control the LED.

You can click the button to toggle the LED state and see the confirmation message on the web browser.</property:Step_Content>
		<property:Step_Content rdf:datatype="http://www.w3.org/2001/XMLSchema#string">In this tutorial, you learned how to create a web server with ESP32 that can control an LED from any device connected to the same WiFi network. You learned how to use the WiFi.h and ESPAsyncWebServer.h libraries to connect the ESP32 to the WiFi network and to create the web server. You also learned how to generate the HTML and CSS code for the web page and how to handle the HTTP requests from the web clients.

You can use this tutorial as a basis for your own projects that involve controlling GPIO pins or other devices with the ESP32 web server. You can also customize the web page design and functionality to suit your needs.

I hope you enjoyed this tutorial and found it useful. If you have any questions or feedback, please let me know. 😊</property:Step_Content>
		<property:Step_Title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">What You Need</property:Step_Title>
		<property:Step_Title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Get PCBs For Your Projects Manufactured</property:Step_Title>
		<property:Step_Title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">How It Works</property:Step_Title>
		<property:Step_Title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">ESP32 Code</property:Step_Title>
		<property:Step_Title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Testing the Web Server</property:Step_Title>
		<property:Step_Title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Conclusion</property:Step_Title>
		<property:Tags rdf:datatype="http://www.w3.org/2001/XMLSchema#string">ESP32</property:Tags>
		<property:Tags rdf:datatype="http://www.w3.org/2001/XMLSchema#string">ESP</property:Tags>
		<property:Tags rdf:datatype="http://www.w3.org/2001/XMLSchema#string">LED</property:Tags>
		<property:Tags rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Relay</property:Tags>
		<property:Tags rdf:datatype="http://www.w3.org/2001/XMLSchema#string">IoT</property:Tags>
		<property:Type rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Creation</property:Type>
		<swivt:wikiPageModificationDate rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2023-12-10T15:39:39Z</swivt:wikiPageModificationDate>
		<property:Modification_date-23aux rdf:datatype="http://www.w3.org/2001/XMLSchema#double">2460289.1525347</property:Modification_date-23aux>
		<swivt:wikiPageSortKey rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Led Control with ESP Webserver</swivt:wikiPageSortKey>
		<property:Comments rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0</property:Comments>
		<property:Page_creator rdf:resource="&wiki;Utilisateur-3ACETECH11"/>
		<property:I_did_it rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0</property:I_did_it>
		<property:Favorites rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0</property:Favorites>
	</swivt:Subject>
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#creationDate" />
	<owl:Class rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Category-3ATutorials" />
	<owl:ObjectProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#page" />
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#wikiNamespace" />
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#wikiPageContentLanguage" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3AArea" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3AComplete" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3ACost" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3ACurrency" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3ADescription" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3ADifficulty" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3ADuration" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3ADuration-2Dtype" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3AIntroduction" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3AIsTranslation" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3ALanguage" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3ALicences" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3AMain_Picture" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3ASourceLanguage" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3AStep_Content" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3AStep_Title" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3ATags" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3AType" />
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#wikiPageModificationDate" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3AModification_date-23aux" />
	<owl:DatatypeProperty rdf:about="http://semantic-mediawiki.org/swivt/1.0#wikiPageSortKey" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3AComments" />
	<owl:ObjectProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3APage_creator" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3AI_did_it" />
	<owl:DatatypeProperty rdf:about="http://https://wikifab.org/wiki/Special:URIResolver/Property-3AFavorites" />
	<!-- Created by Semantic MediaWiki, https://www.semantic-mediawiki.org/ -->
</rdf:RDF>