{"id":86975,"date":"2019-07-11T15:13:49","date_gmt":"2019-07-11T15:13:49","guid":{"rendered":"https:\/\/randomnerdtutorials.com\/?p=86975"},"modified":"2021-09-24T13:10:26","modified_gmt":"2021-09-24T13:10:26","slug":"esp8266-pwm-arduino-ide","status":"publish","type":"post","link":"https:\/\/randomnerdtutorials.com\/esp8266-pwm-arduino-ide\/","title":{"rendered":"ESP8266 NodeMCU PWM with Arduino IDE &#8211; Dim LED (Analog Output)"},"content":{"rendered":"\n<p>This tutorial shows how to generate PWM signals with ESP8266 NodeMCU using Arduino IDE. As an example, we\u2019ll dim the LED brightness by changing the duty cycle over time.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266-PWM-Thumbnail.jpg?resize=1200%2C675&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP8266 Pulse-Width Modulation (PWM) pins with Arduino IDE\" class=\"wp-image-87097\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266-PWM-Thumbnail.jpg?w=1280&amp;quality=100&amp;strip=all&amp;ssl=1 1280w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266-PWM-Thumbnail.jpg?resize=300%2C169&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266-PWM-Thumbnail.jpg?resize=768%2C432&amp;quality=100&amp;strip=all&amp;ssl=1 768w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266-PWM-Thumbnail.jpg?resize=1024%2C576&amp;quality=100&amp;strip=all&amp;ssl=1 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure><\/div>\n\n\n\n<p class=\"rntbox rntclgreen\">To generate a PWM signal on the ESP8266 pins with Arduino IDE, use <span class=\"rnthl rntliteral\">analogWrite(pin, value)<\/span>. The value is an integer between 0 and 255.<\/p>\n\n\n\n<p>For ESP8266 releases before 3.0, the default range is between 0 and 1023. The PWM range may be changed by calling <span class=\"rnthl rntliteral\">analogWriteRange(new_range)<\/span>.<\/p>\n\n\n\n<p>You might also like reading other guides about PWM:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-pwm-arduino-ide\/\">ESP32 PWM with Arduino IDE &#8211; Dim LED<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-esp8266-pwm-micropython\/\">ESP32\/ESP8266 PWM with MicroPython \u2013 Dim LED<\/a><\/li><\/ul>\n\n\n\n<p>Before proceeding with this tutorial you should have the ESP8266 add-on installed in your Arduino IDE. Follow the next tutorial to <a href=\"https:\/\/randomnerdtutorials.com\/how-to-install-esp8266-board-arduino-ide\/\">Install ESP8266 in Arduino IDE<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">ESP8266 NodeMCU PWM (Pulse-Width Modulation)<\/h2>\n\n\n\n<p>The ESP8266 GPIOs can be set either to output 0V or 3.3V, but they can&#8217;t output any voltages in between. However, you can output &#8220;fake&#8221; mid-level voltages using pulse\u2011width modulation (PWM), which is how you\u2019ll produce varying levels of LED brightness for this project.<\/p>\n\n\n\n<p>If you alternate an LED&#8217;s voltage between HIGH and LOW very fast, your eyes can&#8217;t keep up with the speed at which the LED switches on and off; you&#8217;ll simply see some gradations in brightness.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"895\" height=\"182\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/led-fade.png?resize=895%2C182&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP8266 Fade LED with Pulse-Width Modulation (PWM) using analogWrite function\" class=\"wp-image-86976\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/led-fade.png?w=895&amp;quality=100&amp;strip=all&amp;ssl=1 895w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/led-fade.png?resize=300%2C61&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/led-fade.png?resize=768%2C156&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 895px) 100vw, 895px\" \/><\/figure><\/div>\n\n\n\n<p>That&#8217;s basically how PWM works \u2014 by producing an output that changes between HIGH and LOW at a very high frequency. <\/p>\n\n\n\n<p>The duty cycle is the fraction of the time period at which LED is set to HIGH. The following figure illustrates how PWM works.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" decoding=\"async\" width=\"711\" height=\"658\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/PWM-how-it-works.png?resize=711%2C658&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"How Pulse-Width Modulation (PWM) works on ESP8266 to Fade an LED\" class=\"wp-image-86977\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/PWM-how-it-works.png?w=711&amp;quality=100&amp;strip=all&amp;ssl=1 711w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/PWM-how-it-works.png?resize=300%2C278&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 711px) 100vw, 711px\" \/><\/figure><\/div>\n\n\n\n<p>A duty cycle of 50 percent results in 50 percent LED brightness, a duty cycle of 0 means the LED is fully off, and a duty cycle of 100 means the LED is fully on. Changing the duty cycle is how you produce different levels of brightness.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">analogWrite()<\/h2>\n\n\n\n<p>To produce a PWM signal on a given pin you use the following function:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>analogWrite(pin, value);<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><span class=\"rnthl rntliteral\"><strong>pin<\/strong><\/span>: PWM may be used on pins 0 to 16<\/li><li><span class=\"rnthl rntliteral\"><strong>value<\/strong><\/span>: should be in range from 0 to <span class=\"rnthl rntliteral\">PWMRANGE<\/span>, which is 255 by default. When value is 0, PWM is disable on that pin. A value of 255 corresponds to 100% duty cycle<\/li><\/ul>\n\n\n\n<p>You can change the PWM range by calling:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>analogWriteRange(new_range);<\/code><\/pre>\n\n\n\n<p>By default, ESP8266 PWM frequency is 1kHz. You can change PWM frequency with:<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>analogWriteFreq(new_frequency);<\/code><\/pre>\n\n\n\n<p>Valid values are from 100Hz to 40000Hz.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">ESP8266 NodeMCU Dim LED with PWM<\/h2>\n\n\n\n<p>In this section, we&#8217;ll build a simple example that dims an LED so that you see how to use PWM in your projects. You&#8217;ll need the following parts:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/makeradvisor.com\/tools\/esp8266-esp-12e-nodemcu-wi-fi-development-board\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">ESP8266<\/a> (read <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/best-esp8266-wi-fi-development-board\/\" target=\"_blank\">Best ESP8266 development boards<\/a>)<\/li><li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/3mm-5mm-leds-kit-storage-box\/\" target=\"_blank\">5mm LED<\/a><\/li><li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/resistors-kits\/\" target=\"_blank\">330 Ohm resistor<\/a><\/li><li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/mb-102-solderless-breadboard-830-points\/\" target=\"_blank\">Breadboard<\/a><\/li><li><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/jumper-wires-kit-120-pieces\/\" target=\"_blank\">Jumper wires<\/a><\/li><li>Optional <a rel=\"noreferrer noopener\" aria-label=\"Oscilloscope (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/hantek-dso5102p-digital-storage-oscilloscope-dso-review\/\" target=\"_blank\">Oscilloscope<\/a> (read <a rel=\"noreferrer noopener\" aria-label=\"Best Oscilloscopes for Beginners (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/best-oscilloscopes-beginners\/\" target=\"_blank\">Best Oscilloscopes for Beginners<\/a>)<\/li><\/ul>\n\n\n\n<p>If you&#8217;re using an <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/esp-01-wi-fi-board\/\" target=\"_blank\">ESP-01<\/a>, you need an <a href=\"https:\/\/makeradvisor.com\/tools\/ftdi-programmer-board\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">FTDI programmer<\/a> or a <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/makeradvisor.com\/tools\/esp8266-01-serial-adapter\/\" target=\"_blank\">Serial Adapter<\/a> to upload code.<\/p>\n\n\n<p>You can use the preceding links or go directly to <a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\">MakerAdvisor.com\/tools<\/a> to find all the parts for your projects at the best price!<\/p><p style=\"text-align:center;\"><a href=\"https:\/\/makeradvisor.com\/tools\/?utm_source=rnt&utm_medium=post&utm_campaign=post\" target=\"_blank\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2017\/10\/header-200.png?w=1200&#038;quality=100&#038;strip=all&#038;ssl=1\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Schematic<\/h2>\n\n\n\n<p>After uploading the code, wire an LED to your ESP8266 as shown in the following schematic diagram. We&#8217;re connecting the LED to <span class=\"rnthl rntcyellow\">GPIO 2<\/span>, but you can use any other suitable GPIOs.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"930\" height=\"543\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266_PWM_bb.png?resize=930%2C543&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP8266 LED Connected to GPIO 2 Wiring Schematic Diagram\" class=\"wp-image-86983\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266_PWM_bb.png?w=930&amp;quality=100&amp;strip=all&amp;ssl=1 930w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266_PWM_bb.png?resize=300%2C175&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266_PWM_bb.png?resize=768%2C448&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 930px) 100vw, 930px\" \/><\/figure><\/div>\n\n\n\n<p>If you&#8217;re using an ESP-01, you can <a href=\"https:\/\/randomnerdtutorials.com\/esp8266-pinout-reference-gpios\/\">check the board pinout here<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">ESP8266 NodeMCU PWM Code<\/h2>\n\n\n\n<p>Copy the code to your Arduino IDE and upload it to your ESP8266.<\/p>\n\n\n<pre style=\"max-height: 40em; margin-bottom: 20px;\"><code class=\"language-c\">\/*********\n  Rui Santos\n  Complete project details at https:\/\/randomnerdtutorials.com  \n*********\/\n\nconst int ledPin = 2; \n\nvoid setup() {\n  \n}\n\nvoid loop() {\n  \/\/ increase the LED brightness\n  for(int dutyCycle = 0; dutyCycle &lt; 255; dutyCycle++){   \n    \/\/ changing the LED brightness with PWM\n    analogWrite(ledPin, dutyCycle);\n    delay(1);\n  }\n\n  \/\/ decrease the LED brightness\n  for(int dutyCycle = 255; dutyCycle &gt; 0; dutyCycle--){\n    \/\/ changing the LED brightness with PWM\n    analogWrite(ledPin, dutyCycle);\n    delay(1);\n  }\n}\n<\/code><\/pre>\n\t<p style=\"text-align:center\"><a class=\"rntwhite\" href=\"https:\/\/github.com\/RuiSantosdotme\/Random-Nerd-Tutorials\/raw\/master\/Projects\/ESP8266\/ESP8266_PWM_Fade_LED.ino\" target=\"_blank\">View raw code<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How the code works<\/h3>\n\n\n\n<p>Continue reading this section to learn how the code works, or skip to the next section.<\/p>\n\n\n\n<p>Start by defining the pin LED is attached to. In this case, LED is attached to <span class=\"rnthl rntcyellow\">GPIO 2<\/span> (D4).<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>const int ledPin = 2;<\/code><\/pre>\n\n\n\n<p>In the <span class=\"rnthl rntliteral\">loop()<\/span>, you vary the duty cycle between 0 and 255 to increase the LED brightness.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>for(int dutyCycle = 0; dutyCycle &lt; 255; dutyCycle++){ \n  \/\/ changing the LED brightness with PWM\n  analogWrite(ledPin, dutyCycle);\n  delay(1);\n}<\/code><\/pre>\n\n\n\n<p>And then, between 255 and 0 to decrease brightness.<\/p>\n\n\n\n<pre class=\"wp-block-code language-c\"><code>for(int dutyCycle = 255; dutyCycle > 0; dutyCycle--){\n  \/\/ changing the LED brightness with PWM\n  analogWrite(ledPin, dutyCycle);\n  delay(1);\n}<\/code><\/pre>\n\n\n\n<p>To set the LED brightness, you need to use <span class=\"rnthl rntliteral\">analogWrite()<\/span> function that accepts as arguments GPIO where you want to get the PWM signal and a value between 0 and 255 to set the duty cycle. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Upload the Code<\/h2>\n\n\n\n<p>In your Arduino IDE, go to <strong>Tools<\/strong> &gt; <strong>Board<\/strong> and select your ESP8266 model (If you&#8217;re using an ESP-01, select &#8220;Generic ESP8266 Module&#8221;) . <\/p>\n\n\n\n<p>Go to <strong>Tools<\/strong> > <strong>Port<\/strong> and select the COM port the ESP8266 is connected to.<\/p>\n\n\n\n<p>If you&#8217;re using an ESP-01, you need an FTDI programmer or Serial Adapter to upload code. Here are the connections you need to make:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"212\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP-01-FTDI-Programmer.png?resize=975%2C212&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP8266 ESP-01 connected to FTDI programmer to upload new Arduino Sketch\" class=\"wp-image-86987\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP-01-FTDI-Programmer.png?w=975&amp;quality=100&amp;strip=all&amp;ssl=1 975w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP-01-FTDI-Programmer.png?resize=300%2C65&amp;quality=100&amp;strip=all&amp;ssl=1 300w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP-01-FTDI-Programmer.png?resize=768%2C167&amp;quality=100&amp;strip=all&amp;ssl=1 768w\" sizes=\"(max-width: 975px) 100vw, 975px\" \/><\/figure><\/div>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>ESP-01<\/strong><\/td><td><strong>FTDI Programmer<\/strong><\/td><\/tr><tr><td>RX<\/td><td>TX<\/td><\/tr><tr><td>TX<\/td><td>RX<\/td><\/tr><tr><td>CH_PD<\/td><td>3.3V<\/td><\/tr><tr><td>GPIO 0<\/td><td>GND<\/td><\/tr><tr><td>VCC<\/td><td>3.3V<\/td><\/tr><tr><td>GND<\/td><td>GND<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Demonstration<\/h2>\n\n\n\n<p>After uploading your sketch, the LED connected to <span class=\"rnthl rntcyellow\">GPIO 2<\/span> should increase and decrease its brightness over time.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"421\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266-PWM-Demo.jpg?resize=750%2C421&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP8266 Fading LED PWM Circuit Wiring Schematic diagram\" class=\"wp-image-87096\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266-PWM-Demo.jpg?w=750&amp;quality=100&amp;strip=all&amp;ssl=1 750w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266-PWM-Demo.jpg?resize=300%2C168&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/figure><\/div>\n\n\n\n<p>You can connect <span class=\"rnthl rntcyellow\">GPIO 2<\/span> to an <a href=\"https:\/\/makeradvisor.com\/best-oscilloscopes-beginners\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">oscilloscope<\/a> to see how the PWM signal changes over time.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"655\" height=\"481\" src=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/PWM_signal_ESP8266_oscilloscope.png?resize=655%2C481&#038;quality=100&#038;strip=all&#038;ssl=1\" alt=\"ESP8266 Fading LED PWM Circuit Wiring Schematic diagram oscilloscope demonstration\" class=\"wp-image-87072\" srcset=\"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/PWM_signal_ESP8266_oscilloscope.png?w=655&amp;quality=100&amp;strip=all&amp;ssl=1 655w, https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/PWM_signal_ESP8266_oscilloscope.png?resize=300%2C220&amp;quality=100&amp;strip=all&amp;ssl=1 300w\" sizes=\"(max-width: 655px) 100vw, 655px\" \/><\/figure><\/div>\n\n\n\n<p><strong>Read our buying guide: <\/strong><a href=\"https:\/\/makeradvisor.com\/best-oscilloscopes-beginners\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Best Oscilloscopes for Beginners and Electronics Hobbyists (opens in a new tab)\">Best Oscilloscopes for Beginners and Electronics Hobbyists<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Wrapping Up<\/h2>\n\n\n\n<p>We hope you&#8217;ve found this guide about the ESP8266 PWM usage helpful. Besides controlling the LED brightness, PWM can also be used to <a href=\"https:\/\/randomnerdtutorials.com\/esp32-dc-motor-l298n-motor-driver-control-speed-direction\/\">control the DC motor&#8217;s speed<\/a>. <\/p>\n\n\n\n<p>You may also like trying our other projects:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/esp32-esp8266-dht-temperature-and-humidity-oled-display\/\">ESP8266 DHT Temperature and Humidity Readings in OLED Display<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-dht11dht22-temperature-and-humidity-web-server-with-arduino-ide\/\">ESP8266 DHT Temperature and Humidity Web Server<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/hack-pir-motion-sensor-esp8266-hlk-pm03\/\">Hack a PIR Motion Sensor with an ESP8266<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/esp8266-web-server-with-arduino-ide\/\">Build an ESP8266 Web Server<\/a><\/li><\/ul>\n\n\n\n<p>If you like ESP8266 make sure you take a look at our resources:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/randomnerdtutorials.com\/home-automation-using-esp8266\/\"><strong>Home Automation using ESP8266 (eBook + Video Course)<\/strong><\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/projects-esp8266\/\">Free ESP8266 Tutorials and Projects<\/a><\/li><li><a href=\"https:\/\/randomnerdtutorials.com\/micropython-programming-with-esp32-and-esp8266\/\">MicroPython Programming with ESP32 and ESP8266<\/a><\/li><\/ul>\n\n\n\n<p>Thanks for reading.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to generate PWM signals with ESP8266 NodeMCU using Arduino IDE. As an example, we\u2019ll dim the LED brightness by changing the duty cycle over time. To &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"ESP8266 NodeMCU PWM with Arduino IDE &#8211; Dim LED (Analog Output)\" class=\"read-more button\" href=\"https:\/\/randomnerdtutorials.com\/esp8266-pwm-arduino-ide\/#more-86975\" aria-label=\"Read more about ESP8266 NodeMCU PWM with Arduino IDE &#8211; Dim LED (Analog Output)\">CONTINUE READING \u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":87097,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[214,265,240,300,264],"tags":[],"class_list":["post-86975","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-esp8266","category-esp8266-project","category-esp8266-projects","category-0-esp8266","category-project"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/randomnerdtutorials.com\/wp-content\/uploads\/2019\/07\/ESP8266-PWM-Thumbnail.jpg?fit=1280%2C720&quality=100&strip=all&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/86975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/comments?post=86975"}],"version-history":[{"count":2,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/86975\/revisions"}],"predecessor-version":[{"id":106751,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/posts\/86975\/revisions\/106751"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media\/87097"}],"wp:attachment":[{"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/media?parent=86975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/categories?post=86975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/randomnerdtutorials.com\/wp-json\/wp\/v2\/tags?post=86975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}