Fading LED Strip Issue

Hello, Im having an issue fading an led strip in and out. I need it to fade on, stay on for 2 mins, then fade off and stay off for 2 mins. I tried using the basic single LED program, but that one doesn't work because adding delays blocks the code. I also tried using the JLED library with the breathing effect, but cant get it to stay on and off long enough as it malfunctions each time, causing the led to skip the fading effects. Below is the code I'm using with the max on and off times that I can get it to work with. Is there a simple code I can use to do this? I'm a beginner and also need to have this done quickly. Any help is appreciated.

}`#include <jled.h>

// connect LED to pin 9 (PWM capable). LED will breathe with period of
// Fade on for 5 seconds, Stay on for 30, fade off for 5, stay off for 20
auto led = JLed(9).Breathe(5000, 30000, 5000).DelayAfter(20000).Forever();

void setup() { }

void loop() {
led.Update();
}`

Always show us a good schematic of your proposed circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.


In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.

Use the </> icon from the ‘reply menu’ to attach the copied sketch.


Always use non blocking TIMERs in your sketches.

#include <jled.h>

// connect LED to pin 13 (PWM capable). LED will breathe with period of
// 2000ms and a delay of 1000ms after each period.
auto led = JLed(9).Breathe(5000, 30000, 5000).DelayAfter(20000).Forever();

void setup() {}

void loop() {
  led.Update();
}

The green wire on the Vin pin goes where ?

What is the transistor ?

the green wire goes straight to the positive on the led strip.

the transistor is linked here : Bridgold 10pcs IRF540 IRF540N... https://www.amazon.com/dp/B07PH6FPZR?ref=ppx_pop_mob_ap_share

NO

The Vin pin on the Arduino is where you can power the Arduino from an external voltage, 7-9VDC.

Connect the + LED strip wire to an external voltage equal o the strip’s requirements.

There needs to be a connection from the external GND to the Arduino GND.

As this is not a tutorial for beginners I have moved this post here.
@kriedy Please be more careful where you post in future.

You may want to read this before you proceed:-
how to get the best out of this forum

You need to use a logic level FET, that is one which will fully turn on with a 5V signal. Those FETs need a 10V signal to turn on, and so are useless for what you want to do with them.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.