Hackster is hosting Impact Spotlights: Smart Home. Watch the stream live on Thursday!Hackster is hosting Impact Spotlights: Smart Home. Stream on Thursday!
PCBX
Published

PWM for Smooth LED Brightness Transitions

Unlock the power of PWM! Learn how to create smooth LED brightness transitions in our project, simulating waveform signals effortlessly.

BeginnerProtip57

Things used in this project

Story

Read more

Schematics

pwm_clorzVmyf3.png

Code

Untitled file

Arduino
int pwmPin = 11;

void setup() {
  pinMode(pwmPin, OUTPUT);
}

void loop() {
  for (int i = 0; i <= 255; i++) {
    analogWrite(pwmPin, i); // PWM signal
    delay(5);
  }
  for (int i = 255; i >= 0; i--) {
    analogWrite(pwmPin, i); // PWM signal
    delay(5);
  }
}

Credits

PCBX
33 projects • 9 followers
Customer Success: Your one-stop solution for PCB and PCBA services, plus component sourcing. Enjoy FREE online simulation and EDA.
Contact

Comments

Please log in or sign up to comment.