{"id":117,"date":"2026-03-12T02:12:56","date_gmt":"2026-03-12T02:12:56","guid":{"rendered":"https:\/\/shop.zynoxweb.in\/?p=117"},"modified":"2026-03-12T02:12:56","modified_gmt":"2026-03-12T02:12:56","slug":"esp8266-led-control-using-wifi","status":"publish","type":"post","link":"https:\/\/shop.zynoxweb.in\/?p=117","title":{"rendered":"ESP8266 LED Control Using WiFi"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>ESP8266 NodeMCU is a powerful WiFi-enabled microcontroller. It allows you to control devices over the internet.<\/p>\n\n\n\n<p>In this tutorial, we will control an LED using a <strong>web browser over WiFi<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Components Required<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>ESP8266 NodeMCU<\/li>\n\n\n\n<li>LED<\/li>\n\n\n\n<li>220\u03a9 resistor<\/li>\n\n\n\n<li>Breadboard<\/li>\n\n\n\n<li>Jumper wires<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Circuit<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>LED positive \u2192 <strong>D1 pin<\/strong><\/li>\n\n\n\n<li>LED negative \u2192 <strong>220\u03a9 resistor<\/strong><\/li>\n\n\n\n<li>Resistor \u2192 <strong>GND<\/strong><\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">ESP8266 Code<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">#include &lt;ESP8266WiFi.h&gt;const char* ssid = \"YOUR_WIFI\";<br>const char* password = \"YOUR_PASSWORD\";WiFiServer server(80);int ledPin = D1;void setup() {<br>  pinMode(ledPin, OUTPUT);<br>  WiFi.begin(ssid, password);  while (WiFi.status() != WL_CONNECTED) {<br>    delay(500);<br>  }  server.begin();<br>}void loop() {<br>  WiFiClient client = server.available();  if (client) {<br>    String request = client.readStringUntil('\\r');    if (request.indexOf(\"\/LED=ON\") != -1)<br>      digitalWrite(ledPin, HIGH);    if (request.indexOf(\"\/LED=OFF\") != -1)<br>      digitalWrite(ledPin, LOW);    client.println(\"HTTP\/1.1 200 OK\");<br>    client.println(\"Content-Type: text\/html\");<br>    client.println(\"\");<br>    client.println(\"&lt;a href=\\\"\/LED=ON\\\"&gt;LED ON&lt;\/a&gt;&lt;br&gt;\");<br>    client.println(\"&lt;a href=\\\"\/LED=OFF\\\"&gt;LED OFF&lt;\/a&gt;\");<br>  }<br>}<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">How It Works<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>ESP8266 connects to WiFi<\/li>\n\n\n\n<li>A small <strong>web server<\/strong> runs on the module<\/li>\n\n\n\n<li>When you open the IP address in a browser, buttons appear<\/li>\n\n\n\n<li>Clicking buttons sends commands to control the LED<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>This project introduces <strong>IoT basics<\/strong> using ESP8266.<\/p>\n\n\n\n<p>You can extend this project to control:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Relays<\/li>\n\n\n\n<li>Lights<\/li>\n\n\n\n<li>Home appliances<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Introduction ESP8266 NodeMCU is a powerful WiFi-enabled microcontroller. It allows you to control devices over the internet. In this tutorial, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-117","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/shop.zynoxweb.in\/index.php?rest_route=\/wp\/v2\/posts\/117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shop.zynoxweb.in\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shop.zynoxweb.in\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shop.zynoxweb.in\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shop.zynoxweb.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=117"}],"version-history":[{"count":1,"href":"https:\/\/shop.zynoxweb.in\/index.php?rest_route=\/wp\/v2\/posts\/117\/revisions"}],"predecessor-version":[{"id":118,"href":"https:\/\/shop.zynoxweb.in\/index.php?rest_route=\/wp\/v2\/posts\/117\/revisions\/118"}],"wp:attachment":[{"href":"https:\/\/shop.zynoxweb.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shop.zynoxweb.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shop.zynoxweb.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}