LED Brightness control - ESP8266

 

Program

const int ledPin = 2; //D4

void setup() {

  }

void loop() {

  // increase the LED brightness

  for(int dutyCycle = 0; dutyCycle < 255; dutyCycle++){   

    // changing the LED brightness with PWM

    analogWrite(ledPin, dutyCycle);

    delay(25);

  }

  // decrease the LED brightness

  for(int dutyCycle = 255; dutyCycle > 0; dutyCycle--){

    // changing the LED brightness with PWM

    analogWrite(ledPin, dutyCycle);

    delay(25);

  }

}

Comments

Popular posts from this blog

System Bus Types, Functions, and Features

Motherboard form factor

ESP 8266- Ultrasonic Sensor Interfacing