Arduino: PWM an LED; vary the brightness

Experimenting with PWMing an LED to vary the brightness on an Arduino Uno on Tinkercad.

 

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

void loop()
{

  analogWrite(3, 255);
  delay(600); 
  
  
    analogWrite(3, 190);
  delay(600); 
  
    analogWrite(3, 120);
  delay(600); 
  
    analogWrite(3, 55);
  delay(600); 
  
  
  analogWrite(3, 0);
  delay(600);
}

 

Comments are closed