Startertutorials Blog
Tutorials and articles related to programming, computer science, technology and others.
Subscribe to Startertutorials.com's YouTube channel for different tutorial and lecture videos.
Home » Computer Science » IoT Lab » NodeMCU ESP8266 PWM with Arduino IDE
Suryateja Pericherla Categories: IoT Lab. No Comments on NodeMCU ESP8266 PWM with Arduino IDE
0
(0)

In this article we will learn to implement NodeMCU ESP8266 PWM with Arduino IDE. If your are new to Internet of Things (IoT), learn about IoT by visiting our Internet of Things tutorial for beginners.

 

Watch this video to learn about Pulse Width Modulation (PWM) using NodeMCU and Arduino IDE:

 

Aim of Experiment

To implement PWM for controlling the brightness of an LED

 


Subscribe to our monthly newsletter. Get notified about latest articles, offers and contests.


Components Required

  • NodeMCU – 1
  • LED – 1
  • 330 Ω Resistor – 1
  • Breadboard – 1

 

Connections Diagram (Schematic)

NodeMCU ESP8266 PWM with Arduino IDE

 

Code (C++/Arduino IDE)

const int led_pin = D0;

void setup() {
  // put your setup code here, to run once:
  pinMode(led_pin, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  for(int i=0; i<=1024; i++){
    analogWrite(led_pin, i);
    delay(10);
  }
}

 

 

How useful was this post?

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

Your email address will not be published. Required fields are marked *

Facebook
Twitter
Pinterest
Youtube
Instagram
Blogarama - Blog Directory