Buck Regulator LED Driver // PWM

Hi!

I bought a couple of Led Drivers which have a PWM input. I am trying to dim the leds with a very simple code, but it is not working. I always get either an ON or OFF led.

I connected the GND from the arduino to the GND of the led driver, and pin 8 of the arduino to the PWM input of the driver, and I am using the "Fading" example from "Analog".

int ledcontrol = 8;

void setup() {
}

void loop() {
  // fade in from min to max in increments of 5 points:
  for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledcontrol, fadeValue);
    // wait for 30 milliseconds to see the dimming effect
    delay(30);
  }

  // fade out from max to min in increments of 5 points:
  for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledcontrol, fadeValue);
    // wait for 30 milliseconds to see the dimming effect
    delay(30);
  }
}

In the website of the product it is said about the PWM terminal: "PWM terminal. When applied with ground or suspended, full amount of current will be output and when connected with +5v or VIN, output current will be 0."

I dont really understand this sentence. I dont know if it is incorrect chinese english or it escapes my own english, which is not my mother tongue.

thanks in advance for sharing your knowledge!

Try a different pin. Not all of them work with analogWrite. On an Uno for example, pin 9 would work. The silkscreen should have a tilda (~) next to the pins you can use.

Of course!

Thank you so much.