Didn't manage to make the LED fade.?

I followed a lesson on YouTube by Paul McWhorter and managed to write the following

int LEDPin=9;

int waitTimeOn=50;

int waitTimeOff=350;

void setup () {



void loop() {






Of course I played around with the wait times but I was never able to make the LED actually fade in and out. What did I do wrong? Thank you for your help.

randofo4 months ago

You are setting the LED high and low (on and off) with digital write. You need to use analogWrite in the loop and give it values between 0 and 255. I recommend looking at the Fade example in the Arduino software. Also, you may want to check out the Arduino Class: