Hardware problem with Fade Using Millis

Hello people,
I hope I'm in the right place, I'm having a strange problem. I was trying to write a fade in and out sketch.
I couldn't get it to work. I went back to where I learned the code and I just copied a sketch from The Bald Engineer site.

I have copied and played with this code before and it worked.

Well, The LED just turns on and off, no fading. I tried switching analog pins, no luck. I moved from a Nano to a Uno, still no luck. Please does anybody have any ideas?

Please post your sketch.

// Created by James Lewis

const byte pwmLED = A0;

// define directions for LED fade
#define UP 0
#define DOWN 1

// constants for min and max PWM
const int minPWM = 0;
const int maxPWM = 255;

// State Variable for Fade Direction
byte fadeDirection = UP;

// Global Fade Value
// but be bigger than byte and signed, for rollover
int fadeValue = 0;

// How smooth to fade?
byte fadeIncrement = 5;

// millis() timing Variable, just for fading
unsigned long previousFadeMillis;

// How fast to increment?
int fadeInterval = 50;

void setup() {
// put pwmLED into known state (off)
analogWrite(pwmLED, fadeValue);
}

void doTheFade(unsigned long thisMillis) {
// is it time to update yet?
// if not, nothing happens
if (thisMillis - previousFadeMillis >= fadeInterval) {
// yup, it's time!
if (fadeDirection == UP) {
fadeValue = fadeValue + fadeIncrement;
if (fadeValue >= maxPWM) {
// At max, limit and change direction
fadeValue = maxPWM;
fadeDirection = DOWN;
}
} else {
//if we aren't going up, we're going down
fadeValue = fadeValue - fadeIncrement;
if (fadeValue <= minPWM) {
// At min, limit and change direction
fadeValue = minPWM;
fadeDirection = UP;
}
}
// Only need to update when it changes
analogWrite(pwmLED, fadeValue);

// reset millis for the next iteration (fade timer only)
previousFadeMillis = thisMillis;
}
}

void loop() {
// get the current time, for this time around loop
// all millis() timer checks will use this time stamp
unsigned long currentMillis = millis();

doTheFade(currentMillis);

}

Blackfin:
Please post your sketch.

Gave up on my sketch. Trashed it. The one that used to work on my PC is shown. Doesn't work either

Try using a digital pin:

const byte pwmLED = 5;

instead of A0.

Thank you so much. Please see PM

Use a PWM capable pin instead of an analog pin.

Joe

Another victim of the terribly named analogWrite() function. Which doesn't produce an analog output (it's PWM) and which doesn't on the analog pins (which are digital pins with analog input ability) but only on specific digital pins.